Deactivate single post

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1326332
    Dejosée Bernard
    Participant

    Hi All,

    I’d like to deactivate single pages like Services. How can I proceed ?

    Thanks,

    Bernard

    #1326860
    J. Davis
    Keymaster

    Hi Bernard,

    Thanks for your question. You may override the Services post type to disable the front-end view for single Service posts. Try to add the code below to the functions.php file of your theme:

    
    function theme_disable_fronend_mphb_room_service( $args, $post_type ) {
    
        if ( 'mphb_room_service' === $post_type ) {
            $args['publicly_queryable'] = false;
        }
        return $args;
    }
    
    add_filter( 'register_post_type_args', 'theme_disable_fronend_mphb_room_service', 10, 2 );

    best regards,
    J. Davis

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.