WordPress.org

Ready to get started?Download WordPress

Forums

Again: get_categories filter does not apply automatically (2 posts)

  1. maxe
    Member
    Posted 6 years ago #

    hello all!

    here again the question which i posted some days ago and still remains unanswered. if i post this question on a wrong channel, please inform me as well! thanx a lot...

    now the question:

    i use get_categories() sometimes in my plugin code, and have a filter registered on this function:

    function foo($categories){
    echo "TEST!";
    return $categories;
    }
    add_filter('get_category', 'foo', 0);

    but TEST! is never echoed when i call get_categories somewhere else in my code...

    when i add the line apply_filter('get_categories', $categories);

    to the function &get_categories($args = '') in wpincludes/category.php everything works fine. is this a known bug or am i doing something wrong?

    thanks for replying,
    max

  2. gmorehoudh
    Member
    Posted 5 years ago #

    I am having the same problem. I put a die statement in my filter and it's never even called.

    function hide_noaff_category($cats) {
        die('blah');
    }
    
    [...]
    
    add_filter('get_categories','hide_noaff_category');

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.