How to disable the single view for a custom post type? - WordPress Development Stack Exchange

PHOTO EMBED

Thu Nov 11 2021 23:25:28 GMT+0000 (Coordinated Universal Time)

Saved by @richard

<?php
add_action( 'template_redirect', 'wpse_128636_redirect_post' );

function wpse_128636_redirect_post() {
  if ( is_singular( 'sample_post_type' ) ) {
    wp_redirect( home_url(), 301 );
    exit;
  }
}
?>
content_copyCOPY

https://wordpress.stackexchange.com/questions/128636/how-to-disable-the-single-view-for-a-custom-post-type