Articles of register taxonomy

Insert terms for custom taxonomy on plugin activation, or each page load (init hook)

Consider a plugin which adds a custom Taxonomy and then fills the taxonomy with a large term hierarchy (tens of hierarchical terms, may become hundreds in specific installations). I understand that register_taxonomy() does not store data in the database, therefore it must be used via the init hook so that the taxonomy is registered on […]

Custom register_taxonomy ins't showing custom Nav menu

i am using wordpress custom post and register_taxonomy bellow is my code . function epg_works_register() { $labels = array( ‘name’ => __(‘Works’), ‘singular_name’ => __(‘Works’), ‘add_new’ => __(‘Add Works Item’), ‘add_new_item’ => __(‘Add New Works Item’), ‘edit_item’ => __(‘Edit Works Item’), ‘new_item’ => __(‘New Works Item’), ‘view_item’ => __(‘View Works Item’), ‘search_items’ => __(‘Search Works […]

Custom taxonomies not showing up in admin menu

I have defined a few custom taxonomies in my functions.php using the following code: <?php add_action( ‘init’, function() { $labels = array( ‘name’ => _x( ‘Resource Centers’, ‘taxonomy general name’, ‘textdomain’ ), ‘singular_name’ => _x( ‘Resource Center’, ‘taxonomy singular name’, ‘textdomain’ ), ‘search_items’ => __( ‘Search Resource Centers’, ‘textdomain’ ), ‘all_items’ => __( ‘All Resource […]

Custom Taxonomy template not display

I am having problem when I want to display my taxonomy template. I have created one custom taxonomy ‘Location’ for my custom post type ‘Project’. Moreover, I have created templates for it as : taxonomy-{taxonomy_name}-{term}.php taxonomy-{taxonomy_name}.php taxonomy.php None of them work… I just get my archive-{post_type}.php in all case. My targetted URLs are : […]

What are these undocumented arguments for register_taxonomy?

The WordPress codex has an example of the register_taxonomy() function at that shows arguments that are not documented in In particular args[‘sort’] and args[‘args’][order_by]. What’s the story with these?

get_terms from registered taxonomies not working

In functions.php I can var_dump() taxonomies like: $taxonomies=get_taxonomies(”,’names’); echo ‘<pre>’; var_dump($taxonomies); which give me: array(7) { [“category”]=> string(8) “category” [“post_tag”]=> string(8) “post_tag” [“nav_menu”]=> string(8) “nav_menu” [“link_category”]=> string(13) “link_category” [“post_format”]=> string(11) “post_format” [“project”]=> string(7) “project” [“team”]=> string(4) “team” } Now I would like to get all “categories” from my registered taxonomy “project” I’ve tried with get_categories() […]

Adding predefined terms to a taxonomy

I’m writing a plugin for adding a Custom Post called”Dog”. The core of the plugin is strictly based on this one I prefer to add predefined sexes after the plugin activation, I would like to add “Male”, “Female”, “Unapplicable” from the start. So, based on other resources I wrote that in the same .php […]

How to register child taxonomies?

Should I register both parent and child as ‘hierarchical’ => true, if there’s no grandchild? If “Movie” is the top level taxonomy, when I register a child, is it as simply as: ‘parent_item’ => __( ‘Parent Movie’ )? How to automatically asign a child taxonomy to a post? So far, I figured out how to […]

Pagination on Custom Tax Pages Removes Spaces from Query Vars

I’ve got a weird problem that’s very similar to this one: Why does WordPress Pagination Remove the Spaces from my GET Variable?. Except that mine isn’t withn search results pages–it’s with custom taxonomy pages. Here’s the problem: clean WP install with no plugins. I add a custom taxonomy like so in my functions file: register_taxonomy( […]

previous_post_link/next_post_link disappear when excluding by post_format

I am trying to exclude aside post formats from my next and previous links, but for some reason, using get_term_by is not returning me the term_id for the post_format taxonomy. I see this taxonomy being used by the WordPress core here, so I know I’m doing this the right way. According to this posting, I […]