[wp-hackers] changing the built in categories label on the add post screen

Caio Rogerio Ribeiro caiorogerio at gmail.com
Sat Nov 19 02:29:32 UTC 2011


If you wann do it in a elegant way I would register a brand new tax,
unregister the category and update the the database (a 5 minutes job)
but If you dont mind about elegance a filter on a gettext or maybe
another hook resolve it quickly

But its friday night

Enviado via iPhone

Em 18/11/2011, às 22:14, Justin Tadlock <justin at justintadlock.com> escreveu:

> Just hook into `gettext` with a custom filter.  Read:
> http://blog.ftwr.co.uk/archives/2010/01/02/mangling-strings-for-fun-and-profit/
>
> On 11/18/2011 5:44 PM, Paul Menard wrote:
>> Really guys. I know it's Friday evening but hacking the code and changing the database. Really. Easiest solution is to just add your own init action hook. Grab the global $wp_taxonomies object then replace the label. No need to unregister or register some other taxonomy.
>>
>> Is the following advisable? Probably not but then again WordPress does not provide any hooks to override these.
>>
>> Something like the following:
>>
>>
>> add_action('init', 'change_category_taxonomy_label', 999);
>> function change_category_taxonomy_label() {
>>
>>    global $wp_taxonomies;
>>
>>    // Add your own code to verify this object and exists. You have been warned
>>    $wp_taxonomies['category']->labels->menu_name = "Topics";
>> }
>>
>> P-
>>
>>
>>
>> On Nov 18, 2011, at 6:36 PM, William P. Davis wrote:
>>
>>> This is getting complicated. Maybe just create a translation file?
>>> Sent from my BlackBerry® wireless device
>>>
>>> -----Original Message-----
>>> From: Charles Frees-Melvin<charles.freesmelvin at me.com>
>>> Sender: wp-hackers-bounces at lists.automattic.com
>>> Date: Fri, 18 Nov 2011 19:31:10
>>> To: wp-hackers at lists.automattic.com<wp-hackers at lists.automattic.com>
>>> Reply-To: wp-hackers at lists.automattic.com
>>> Subject: Re: [wp-hackers] changing the built in categories label on the add
>>> post screen
>>>
>>> Add a new taxonomy "topics" and then change in the _terms table all Categories to topics. That will convert what was category's to the topic taxonomy. Then just unregister the category tax or de-link it from the "post" post type.
>>>
>>> --
>>> Charles E. Frees-Melvin
>>>
>>> Sent from my Rogers iPhone 4S
>>>
>>> On 2011-11-18, at 19:18, IC IC<icwordpress at gmail.com>  wrote:
>>>
>>>> When you unregister, what happens to the existing categories that have been
>>>> created?
>>>>
>>>> Shall I just run this at the twentyten functions.php?
>>>>
>>>> add_action( 'init', 'unregister_taxonomy');
>>>> function unregister_taxonomy(){
>>>>   global $wp_taxonomies;
>>>>   $taxonomy = 'category';
>>>>   if ( taxonomy_exists( $taxonomy))
>>>>       unset( $wp_taxonomies[$taxonomy]);
>>>> }
>>>>
>>>> and after that, go find the post.php and change the label from categories
>>>> to topics? is that a safe thing to do ?
>>>> wouldn't this go away when we update the wordpress core though?
>>>>
>>>> I want the label topics to stay permanently regardless of the updates..
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Nov 18, 2011 at 3:08 PM, Charles Frees-Melvin<
>>>> charles.freesmelvin at me.com>  wrote:
>>>>
>>>>> You can't it is hard coded into wp-includes/post.php
>>>>>
>>>>> The best option is to unregister categories and replace with a new tax.
>>>>>
>>>>> --
>>>>> Charles E. Frees-Melvin
>>>>>
>>>>> Sent from my Rogers iPhone 4S
>>>>>
>>>>> On 2011-11-18, at 18:59, IC IC<icwordpress at gmail.com>  wrote:
>>>>>
>>>>>> Which table stores the "categories" label?
>>>>>>
>>>>>> I already changed the categories folder name from "category" to "topics"
>>>>>> but the add post screen still display "Categories" as the label?
>>>>>> I want to change that too to Topics.
>>>>>>
>>>>>> When you create a custom taxonomies, this issue is not a problem cause it
>>>>>> has the label argument.
>>>>>> but since the categories already come pre-created, I need to make that
>>>>>> change straight into the table!
>>>>>> where do I do that?
>>>>>> _______________________________________________
>>>>>> 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
>>> _______________________________________________
>>> 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