[wp-hackers] Custom taxonomies and admin menus

Mike Schinkel mikeschinkel at newclarity.net
Sat Jul 31 23:06:03 UTC 2010


Is your register_post('listing',...) also in an 'init' hook vs. an 'admin_init' hook?

When I took your code it didn't show up in the menu until I changed it to 'init'.  I had to add a register_post() for 'listing', of course.  Here's what it looks like (for testing purposes, of course.) Is yours have public and show_ui set to true?:

 register_post_type('listing',array(
    'label' => 'Listings',
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'supports' => array('title')
  ));

This is what the admin screen  looks like with your code in an init hook in a (mostly) clean copy of WordPress 3.0.1:

http://mikeschinkel.com/websnaps/skitched-20100731-190500.png

-Mike

On Jul 31, 2010, at 6:59 PM, Joshua Sibelman wrote:

> I have. It makes no difference.
> 
> 
> On Jul 31, 2010, at 3:56 PM, Mike Schinkel wrote:
> 
>> Hi Joshua :
>> 
>> Try this instead:
>> 
>> add_action('init', array($this, 'createListingTaxonomies'), 0);
>> 
>> -Mike
>> 
>> On Jul 31, 2010, at 6:47 PM, Joshua Sibelman wrote:
>> 
>>> http://pastebin.com/App1td55
>>> 
>>> Thanks for checking it out.
>>> 
>>> 
>>> 
>>> On Jul 31, 2010, at 3:44 PM, Mike Schinkel wrote:
>>> 
>>>> Can you post your register_taxonomy() code?
>>>> 
>>>> On Jul 31, 2010, at 6:40 PM, Joshua Sibelman wrote:
>>>> 
>>>>> I'm registering the taxonomies on init, like so:
>>>>> add_action('admin_init', array($this, 'createListingTaxonomies'), 0);
>>>>> 
>>>>> 
>>>>> On Jul 31, 2010, at 3:22 PM, Mike Schinkel wrote:
>>>>> 
>>>>>> In the plugin are you doing it in the global area of the .PHP file on in an init hook?
>>>>>> 
>>>>>> -Mike
>>>>>> 
>>>>>> On Jul 31, 2010, at 5:52 PM, Joshua Sibelman wrote:
>>>>>> 
>>>>>>> I hope this isn't an obvious question, but I wasn't able to find anything on this in the Codex.
>>>>>>> 
>>>>>>> I created a plugin for a client that registers a new post type with two attendant hierarchical taxonomies. When the taxonomies are registered via the plugin, I do not see line items in the admin menu to access them for editing. If I move the taxonomy registration out of the plugin and into the theme's functions.php file, then the menu items appear.
>>>>>>> 
>>>>>>> Can anyone explain this behavior? Is there something specific I need to do when registering taxonomies via plugin vs. the functions.php file to get the menus to appear?
>>>>>>> 
>>>>>>> Thanks for any help you can give me.
>>>>>>> 
>>>>>>> Josh
>>>> 
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> 
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>> 
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list