• Hi,

    I need to exclude a certain category of posts from my recent posts widget. This certain category is only used in Wooslider and its content is not relevant for my posts(news) page or recent posts widget.

    I managed to exclude the posts from my posts-page by using the code:

    function exclude_category($query) {
    if ( $query->is_home() ) {
    $query->set('cat', '-xx');
    }
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');

    However I am unable to do the same for my Widget.

    Could anyone point me in the right direction? Thanks.

  • The topic ‘Exclude Posts Categoryfrom Recent Posts Widget’ is closed to new replies.