[wp-hackers] wp releases : is it planned in any way ?

Malaiac malaiac at gmail.com
Fri Sep 12 07:25:15 GMT 2008

2008/9/12, Jacob Santos <wordpress at santosj.name>:
> The purpose of the get_categories is to retrieve all of the categories and
> then make them backwards compatible. What you are trying to do is to get all
> of your taxonomy terms. It would be simple to create your own function for
> achieving that.
Already done.

> Of the 9 line function body, you only need 2 lines to create
> your own function. I'm not sure where you are getting 2000 lines of code,
> but forcing the core code to dance around your modifications is not
> something I would be happy about without good enough reason.
I don't need the modification to actually get the categories of my own
taxonomy. I need the modification for all the other WP functions to
get the categories of my own taxonomy.

Without the mod, I'd have to recode one or two dozens of (big)
functions which start by $categories = &get_categories($r); and do not
apply filters on it. Maybe not 2 000 lines of code, but surely like a
40ko futile copy / paste of functions, and conditional tags in all the
templates files ( if(is_directory()) my_list_categories($args); else
wp_list_categories($args); ).
Copy pasting is not above my level, and time is not an issue (find and
replace 'category' => 'my_category' ). But adding 40k of code, and
almost making a fork of major WP functions is an issue regarding speed
and future maintenance.

>  Functions of that limited purpose
woosh. did you count the occurences of get_categories() calls (front
and back ends)  ?

> get_terms() is well flexible enough to allow you enough freedom to
> employ in any fashion to create your own function for what you have in mind.
Well, I'd like all these major WP functions to know what I have in my
mind, but well..

Point is :
instead of replacing the call in 40 or so functions which all ask for
get_categories(), I find it more elegant to act on the get_categories

>  You can also create an wrapper around get_categories by using the 'include'
> argument for get_categories(). If you get the IDs of the terms of your
> taxonomy, you can include your specialized categories along with the
> WordPress ones.
my specialised categories don't mix with post categories. and fetching
the correct ID for all categories call = twice the SQL load.

>  You can also hook into the 'get_terms' filter and look for the 'category'
> and 'link_category' taxonomies to add your taxonomy terms to.
the get_terms filter is way too late in the function to do that. I
mean, it is in the right position (just before the return), but it's
after the query and after the sorting.

>  I mean, I not
> sure exactly what you are trying to achieve or how, but there are several
> ways around not doing anything to get_categories().

Well, after DD32 thoughtful reply, a simple filter addition would do
the trick, without compromizing the code.

>   Wonder how  much 20 points can mean when it comes to an IQ
>  That said, I'm going to do everything possible to argue against your position, no matter how childish it seems.
Well I guess you have your answer now, don't you ?


More information about the wp-hackers mailing list