Skip to content

Instantly share code, notes, and snippets.

@chrdesigner chrdesigner/functions.php
Last active Jan 4, 2016

Embed
What would you like to do?
Set a custom post type to not show up on the frontend - WordPress
<?php
function chr_redirect_post_type() {
global $wp_query;
if ( is_post_type_archive('sliders') || is_singular('sliders') ) :
$url = get_bloginfo('url');
wp_redirect( esc_url_raw( $url ), 301 );
exit();
endif;
}
add_action ( 'template_redirect', 'chr_redirect_post_type', 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.