Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In my theme, I registered a taxonomy by the name of tax_groups for a custom post type named custom_items. So the following URL was returning the lastest custom_items

The Search widget was also working perfectly fine but not Tag and Taxonomy links like these:
share|improve this question

1 Answer 1

up vote 0 down vote accepted

I had to modify queries before they run. So the best practice was to add the following code to function.php:

if (!function_exists('my_theme_filter')) {
    function my_theme_filter( $query ){

    if ( $query->is_main_query() )
        if ( $query->get( 'tag' ) OR is_search() )
            $query->set( 'post_type', array( 'artprim_item' ) );

    //echo '<pre>'; print_r($query); echo '</pre>';

    return $query;
add_filter( 'pre_get_posts', 'my_theme_filter' );
share|improve this answer
I wanted to mention that the method described in [this question] (…) solved the problem for me. – JPollock Jan 8 '13 at 6:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.