Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Gabri Gonzalez

    (@devgabri)

    Thanks for support.

    I have taken a look but it seems that it is to create a new cache of a whole site and I think is more complex than I need, in any case, I will give a try maybe to adapt it.

    That feature is not supported now for any technical reason?
    Do not you think it can be very useful?
    I think it would be very useful since you would not have to wait for a new visit after clear the cached version of a post.

    By the way, plugin and support both awesome.

    Thanks a lot

    I tried the code in my local installation before posting here and runs ok.

    Be sure to write your ID values separated by commas, and all of them within single quotes.

    $query->set( 'cat', '-ID1, -ID2, -ID3' );

    or

    $query->set( 'cat', '-ID4' );

    Please, mark as resolved the thread if it is.

    Regards.

    In your theme’s functions.php file, you can add the following code, replacing in the third line the category IDs you want to exclude. In this example, I exclude the categories with ID numbers 2 and 3.

    
    function exclude_category_home( $query ) {
    if ( $query->is_home ) {
    $query->set( 'cat', '-2, -3' );
    }
    return $query;
    }
    
    add_filter( 'pre_get_posts', 'exclude_category_home' );
    

    If you don’t want to edit your theme’s functions.php file, you can create your own plugin, or if you have already created, simply throw in the code shown.

    Another solution, maybe this plugin solves your need Ultimate category excluder.

    Regards

    • This reply was modified 8 years, 1 month ago by Gabri Gonzalez. Reason: Add a related plugin
Viewing 3 replies - 1 through 3 (of 3 total)