Get random terms

Is it possible to get random terms? To get random posts you could use WP_Query and set ‘orderby’ => ‘rand’. But is there any way to do that with terms? I’ve tried this: $terms = get_terms( array( ‘taxonomy’ => ‘webshops’, ‘hide_empty’ => false, ‘orderby’ => ‘rand’, ‘number’ => 6 ) ); 1 Answer 1 Unlike … Read more

get_terms return errors

Hi when i try to get_terms(); in theme options via this code $catalogs_terms = get_terms( ‘catalogs’ ); $mycatalogs = array( -1 => ‘Select a catalog’ ); if ( $catalogs_terms ) { foreach ( $catalogs_terms as $catalog_term ) { $mycatalogs[$catalog_term->term_id] = $catalog_term->name; } } return empty but this code is working fine every where in pages … Read more

Show all wp_get_post_terms slugs

I am using the following code to display my custom taxonomy slugs. However it is only displaying the first category and not all the related categories. I know this is fairly simple and is to do with [0] but I can’t figure out how to change it. $getslugid = wp_get_post_terms( $post->ID, ‘opd_taggallery’ ); $getslug = … Read more

Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms

I am importing a large DB from an Excel spreadsheet into a wordpress DB. I was going to do it manually by creating a new table but decided to import it into the existing wordpress framework as it will allow me to change information manually in the wordpress back end. I was importing all 2000 … Read more

Display Terms for all posts in Current Archive or Query

I am using the following code to create a list of linked terms belonging to a taxonomy. <?php $taxonomy = ‘taxonomy_name’; $queried_term = get_query_var($taxonomy); $terms = get_terms($taxonomy, ‘slug=’.$queried_term); if ($terms) { echo ‘<ul>’; foreach($terms as $term) { echo ‘<li><a href=”‘.get_term_link($term->slug, $taxonomy).'”>’.$term->name.'</a></li>’; } echo ‘</ul>’; } ?> Is there a way that I can modify this … Read more

How can I get WP to build a feed based on multiple taxonomy terms

Currently, the best way to get a feed generated for a single taxonomy term is by letting wordpress generate the content automatically: example.com/wordpress/feed?tax_slug=term_slug However, is there a built in way of being able to produce a feed using multiple terms from the same taxonomy? For example: example.com/wordpress/feed?tax_slug=term1,term2,term3&another_tax_slug=term4,term5 The idea is to use built in wordpress … Read more

How to filter the taxonomy terms based on another taxonomy term

I have created a custom Post Type called “Tour” which Holds up-to five Taxonomies called “destination”, “Types”, “Month of Travel”, “Year of Travel” and “Led by”. Now I brought them as drop-down category using “wp_dropdown_categories” – (each of the taxonomy were listed as drop down). and search term works fine in the combinations (if exist). … Read more

Get those terms with a specific meta key value

I’m having a custom taxonomy for addresses. And I’ve created a true/false button through acf plugin to tell an address that it’s the standard address. How can I get only the one term that has “standard address” set to “true”? Here is my approach: $taxonomy = ‘addresses’; $args = array( ‘numberposts’ => 1, ‘meta_query’ => … Read more