Disable link for single posts

  1. you can either disable click events using CSS.

    .linkclass {     pointer-events: none;}
    
  2. Or better Modify the template and remove the part which creates anchor links for titles.

note: with the above, it is still possible to access the page by directly putting the full URL in the browser. if you want to completely remove the single page.

add_action('register_post_type_args', function ($args, $postType) {
    if ($postType !== 'post'){
        return $args;
    }

    $args['publicly_queryable'] = false;
  

    return $args;
}, 99, 2);

error code: 523