Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Redirect CTP single to CPT archive.
- */
- function dom_single_redirect_post() {
- $queried_post_type = get_query_var('post_type');
- if (
- is_single() && 'team' == $queried_post_type ||
- is_single() && 'kranten' == $queried_post_type ||
- is_single() && 'klanten' == $queried_post_type ||
- is_single() && 'geschiedenis' == $queried_post_type
- ) {
- wp_redirect( get_post_type_archive_link($queried_post_type), 301 );
- exit;
- }
- }
- add_action( 'template_redirect', 'dom_single_redirect_post' );
- /**
- * Add noindex, nofollow to CPT single.
- */
- add_filter( 'the_seo_framework_robots_meta_array', function( $meta ) {
- if ( is_singular( array( 'team', 'kranten', 'klanten', 'geschiedenis' ) ) ) {
- if ( the_seo_framework() ) {
- $meta['noindex'] = 'noindex';
- $meta['nofollow'] = 'nofollow';
- }
- }
- return $meta;
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement