Disable Archives

Home Forums Calendar Products Events Calendar PRO Disable Archives

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1138644
    James
    Participant

    Is there any way to disable the Events post type from having archives?

    I’ve tried the following, but it hasn’t worked.
    // Remove Events Archive
    add_filter( 'register_post_type_args', 'remove_events_archive' , 9999999999999999999, 2 );

    function remove_events_archive( $args, $post_type ){

    // Do not filter any other post type
    if ( 'tribe_events' !== $post_type ) {

    // Give other post_types their original arguments
    return $args;

    }

    $args['has_archive'] = false;
    // Give the custom-css-js post type it's arguments
    return $args;

    }

    We don’t use the archive page, and lot’s of pages are getting crawled for each day (/event/2016-05-28 etc).

    #1139000
    Brook
    Participant

    Howdy James,

    That should be pretty doable. If you run the following code once it will update our plugin telling it that all views (archives) are not used:

    tribe_update_option( 'tribeEnableViews', array() );

    And that should be it!

    Note: You’ll notice that in WP-Admin > Events > Settings > Display all views will now be deselected. If you ever reselect a view and hit save, it will show up again. However if you subsequently need to deselect all views you will need to run that code once more to deselect them, as ordinarily you are prevented from hiding the last remaining view.

    Did that do what you wanted?

    Cheers!

    – Brook

    #1139912
    James
    Participant

    That seems to have done the trick.

    Thank you very much 🙂

    #1140117
    Brook
    Participant

    Excellent! Thanks for getting back. Cheers!

    – Brook

    #1140118
    Brook
    Participant

    Excellent! Thanks for getting back. Cheers!

    – Brook

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Disable Archives’ is closed to new replies.