Single page of custom post not found at remote server

I dont know if it is a rewrite issue. These are the facts:

  1. I have a custom post type. Single page of this CPT is shown only if I have plain permalinks selected. Other configurations like post name returns 404 .
  2. This problem only happens at remote server (staging and production). At development, all works.

Flushing permalinks does not work. What can be the cause? Thanks!

More info:

register_post_type( 'book', $args_books );

My single template is the single default template:
<?php get_template_part('templates/content-single', get_post_type()); ?>

My content template for single book is:

Is there a rewrite option in your $args_books?
Check if there is a .htaccess file present in the root of your remote server, if not create one and visit and save your permalink settings again. It’s probably a rewrite issue.

1 Like

Thanks for the answer.

I had no rewrite arguments. Default should be used. Just in case, I added:

$rewrite = array(
        'slug'                  => 'post_type',
        'with_front'            => true,
        'pages'                 => true,
        'feeds'                 => true,
    $args_books = array(
        'rewrite'               => $rewrite,

Also, I added an empty .htacces file to:

And flush permalinks again.

Is it ok? (the problem persists)

Yeah that should work…
Can you check if anything is written to your .htaccess file? Other wise make it’s file permissions 644 and try flushing again.

1 Like

I got it! I had a custom taxonomy with

'rewrite' => array( 'slug' => 'book' ),

making conflict :sweat:

To change the slug did the trick. Thank you very much for the help!

Glad your worked it out :slightly_smiling: