‘publicly_queryable’ => false not working as expected for custom post_type
If you want archives, but not singular view, then ‘publicly_queryable’ can’t help you. If you want that visiting a singular post send a 404… just do it. You can hook ‘template_redirect’ and manually set the 404: add_action( ‘template_redirect’, function () { if (is_singular(‘tattooer’)) { global $wp_query; $wp_query->posts = []; $wp_query->post = null; $wp_query->set_404(); status_header(404); nocache_headers(); … Read more