Support » Plugin: Annual Archive » Excluding Categories

  • Resolved julie

    (@jacleaves)


    I found your support post where you recommended using this function to filter unwanted categories from showing in archive. I’ve used this code:

    function my_custom_get_posts( $query ) {
    //ignore main query
    if ( is_admin() || ! $query->is_main_query() )
    return;
    //remove cats by id from archive query
    if ( $query->is_archive() ) {
    $bad_kitty = array(2, 4, 8);
    $query->set( ‘post__not_in’, $bad_kitty );
    }
    }
    add_action( ‘pre_get_posts’, ‘my_custom_get_posts’, 1 );

    Changed the array to = the cats I don’t want to display, but they still show up. If you could send me a PM I’ll send you the link and give you login info if you’d like.

    Thank you — it’s a great plugin and will be perfect if I can get this to work!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor twinpictures

    (@twinpictures)

    What exactly did you change when you:

    Changed the array to = the cats I don’t want to display

    If you would like us to look into it for you, send us an email at info [at] twinpictures [dot] de and be sure to include a link back to this thread.

    julie

    (@jacleaves)

    Hi twinpictures,

    Thank you for your quick response! I sent you an email with the info you requested.

    Plugin Contributor twinpictures

    (@twinpictures)

    Looks this issue was resolved.
    Hope we were able to provide you useful support on this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Excluding Categories’ is closed to new replies.