Last active
January 4, 2016 23:57
-
-
Save chrdesigner/dd65f8674d8631844962 to your computer and use it in GitHub Desktop.
Set a custom post type to not show up on the frontend - WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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