WordPress.org

Support

Support » How-To and Troubleshooting » Excluding Select Categories From Single Post Nav

Excluding Select Categories From Single Post Nav

  • I used this code at the bottom of my functions.php to exclude select categories from front page:

    function exclude_category($query) {
    if ( $query->is_home ) {
    $query->set(‘cat’, ‘-254’);
    }
    return $query;
    }
    add_filter(‘pre_get_posts’, ‘exclude_category’);

    It works perfect, the only thing is when you click on a post you can still get to that post that was supposed to excluded in the page navigation.

    For example, if you go to my homepage and click on the first post you will then see page navigation for older and newer posts. The newer post being the excluded one.

    Does anyone know how to exclude certain categories from page navigation on single posts? Please help!

    Take a look here: Los

  • The topic ‘Excluding Select Categories From Single Post Nav’ is closed to new replies.
Skip to toolbar