Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1123906

    Hi there,

    i would like to exclude a certain category from displaying, search etc.
    i already tried this well-known version in the functions.php – only getting several warnings/failures:

    function exclude_category_posts( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
    $query->set( ‘cat’, ‘-7’ );
    }
    }
    add_action( ‘pre_get_posts’, ‘exclude_category_posts’ );

    `

    i even tried the UCE-plugIn which didn’t worked either – every category was excluded!

    So please – it would be very kind, if you show me how to do it

    best regards

    #1124415

    Hey dreisatz,

    Please have a look at the following thread:

    https://kriesi.at/support/topic/exclude-a-category-from-search-index/#post-608556 Your code looks different from this one.

    Best regards,
    Victoria

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.