Have you flushed your permalink rules, just as an extra step to figure out what’s going on? Do the single posts work with permalinks turned off?
Hi
I have the same issue and yes permalinks (http://mydomaine.com/%postname%) rules flushed.
Here is my CPT:
function cptui_register_my_cpts_adresse() {
/**
* Post Type: Adresses.
*/
$labels = array(
"name" => __( 'Adresses', '' ),
"singular_name" => __( 'Adresse', '' ),
);
$args = array(
"label" => __( 'Adresses', '' ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => false,
"rest_base" => "",
"has_archive" => false,
"show_in_menu" => true,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => array( "slug" => "adresse", "with_front" => true ),
"query_var" => true,
"menu_icon" => "dashicons-admin-users",
"supports" => array( "title", "editor", "thumbnail", "excerpt", "trackbacks", "custom-fields", "comments", "revisions", "author", "page-attributes", "post-formats" ),
"taxonomies" => array( "category" ),
);
register_post_type( "adresse", $args );
}
add_action( 'init', 'cptui_register_my_cpts_adresse' );
Googled my issue and find the answer here: https://stackoverflow.com/questions/19552409/wordpress-preview-broken-on-custom-post-types
In short remove “post-formats” from the support:
"supports" => array( "title", "editor", "thumbnail", "excerpt", "trackbacks", "custom-fields", "comments", "revisions", "author", "page-attributes", "post-formats>" ),
-
This reply was modified 8 years, 11 months ago by
pako69.
Odd, but whatever works, I guess 😀