How to overwrite a specific parameter in a core taxonomy?

Version 4.4 saw the introduction of the register_taxonomy_args filter in register_taxonomy() which you can use to filter the arguments used to register a taxonomy /** * Filter the arguments for registering a taxonomy. * * @since 4.4.0 * * @param array $args Array of arguments for registering a taxonomy. * @param array $object_type Array of … Read more

Sorting custom taxonomy causes menus error

Currently your code is modifying all term queries, both in the front-end and in the back-end. Each navigational menu is registered as a term in the nav_menu taxonomy, so when you visit the backend to work on the menus, those queries have been modified too by your code snippet. For example, I don’t see any … Read more

check if tag exists in wp database

I think you’re looking for term_exists function. Example Code: <?php $term = term_exists(‘tag1’, ‘post_tag’); if ($term !== 0 && $term !== null) { echo “‘tag1’ post_tag exists!”; } else { echo “‘tag1’ post_tag does not exist!”; } ?>

List taxonomy terms as links

My apologies. After some more searching, I found that I could pass the taxonomy as an argument in wp_list_categories. Here is the info via WordPress Codex.

Child Terms not Displaying on the Taxonomy Term Admin Screen

I’ve encountered this kind of problem when i was building some front end post / term creation form. The number oh the ‘Right Now’ dashboard shows the right number of term, but the new term doesn’t shows up in the taxonomy admin screen. The solution: delete_option(‘taxonomy-name_children’); where ‘taxonomy-name’ is the name of the taxonomy. Hope … Read more

Exclude custom taxonomy from search results and archive pages

Copy the following snippet and paste it into the code of your theme, preferably in the functions.php file: /* Exclude a Category from Search Results */ add_filter( ‘pre_get_posts’ , ‘search_exc_cats’ ); function search_exc_cats( $query ) { if( $query->is_admin ) return $query; if( $query->is_search ) { $query->set( ‘category__not_in’ , array( 30 ) ); // Cat ID … Read more

get_terms() How many is TOO many?

Ad slowing down) Lame answer: depends on your server and stuff. Ad possible bug) wp_count_terms(); is a level “above” get_terms(); and therefore has values like ‘hide_empty’ and ‘fields’ already set. I’d say: diff your $args against those predefinied by wp_count_term();. The later function does nothing than calling the get_terms() at it’s end.