Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Design Exclude category from custom post type archive

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #264949
    brokenmouse
    Participant

    Hey everyone. I have a custom post type, ‘showcases’, and its archive page shows all the primary categories in that type display on the page. Each showcase can have multiple categories assigned to it (e.x. Water, Water Slides, Play). Then the archive will show the showcase with an image and locaiton. The issue lies in that we need to not show one category due to it not being a showcase, just using the template (for time/qa/c sake). In my functions I have this:

    function exclude_category( $query )
    {
    if (is_post_type_archive(‘showcases’)) {
    $query->set(‘cat’, ‘-32’);
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_category’);

    I was hoping this would stop it from being seen, however it still shows up. I even tried adding multiple cat ids. Any ideas?

Viewing 1 post (of 1 total)
  • The forum ‘Design’ is closed to new topics and replies.