Support » Plugins » Hacks » Using WP_Query within plugin to filter categories

  • Hello,

    I’ve been trying to write a plugin that filter categories on the homepage.

    Given a set of categories saved as options in the DB., I retrieve them like:
    $categories = get_option(‘tecf_cat-list’);

    Then I use:
    $query = new WP_Query(array( ‘category__not_in’ => $categories ) );

    but I get a blank page after using this.
    I’m calling the function on the ‘posts_request’ hook.

    Shouldn’t I use WP_Query() from within a plugin? (I tried to modify values of the global $wp_query variable without success).

    Any clues about this incident? (You can point me to the right documentation, I’m not afraid to read).


  • The topic ‘Using WP_Query within plugin to filter categories’ is closed to new replies.