I have capabilities assigned in my register_post_type(). Then, I implemented taxonomies on my plugin. Where the $args in taxonomy are as follows:

$args = array(
  'label'=>'Partner Type',
  'labels' => array(
    'name' => __('Partners'),
    'singular_name' => __('Partner Type'),
    'menu_name' => __('Partner Types'),
    'all_items' => __('All Partner Types'),
    'edit_item' => __('Edit Partner Type'),
    'view_item' => __('View Partner Type'),
    'update_item' => __('Update Partner Type'),
    'add_new_item' => __('Add New Partner Type'),
    'new_item_name' => __('NEw Item Type'),
    'parent_item' => __('Parent Type'),
    'parent_item_colon' => __('Parent Partner Colon'),
    'search_items' => __('Search Partner'),
    'popular_items' => __('Popular Partner Type'),
    'separate_items_with_commas' => __('Separate partner types with commas'),
    'add_or_remove_items' => __('Add or Remove Partner Types'),
    'choose_from_most_used' => __('Choose from Most Used Partner Type'),
    'not_found' => __('Partner Type Not Found'),
  'hierarchical' => true,

register_taxonomy('partner_taxonomies', 'partners',$args);

$args in post_type contains:

'taxonomies' => 'partner_taxonomies',

Then, I get the error

Invalid argument supplied for foreach() in /var/www/html/stecLive/wp-includes/post.php on line 1346

Where the code says:

foreach ( $args->taxonomies as $taxonomy ) {
  register_taxonomy_for_object_type( $taxonomy, $post_type );

I don't see 'taxonomies' as one of the arguments in register_taxonomy(). How would you use or supply an array for 'taxonomies'? Or in other words, what am I doing wrong?

1 Answer 1


I got it now...

The error inside 'taxonomies' belong to register_post_type() function. It does not belong to register_taxonomy(). The right way of declaring 'taxonomies' inside register_post_type() is:

'taxonomies' => array('partner_type_taxonomies'),

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.