I want to use AMP with a Custom Post Type in WordPress. For this reason, I've added the following code to my functions.php:
add_action( 'amp_init', 'xyz_amp_add_review_cpt' );
function xyz_amp_add_review_cpt() {
add_post_type_support( 'xyz-review', AMP_QUERY_VAR );
}
The code is from the official plugin documentation: https://github.com/Automattic/amp-wp/blob/master/readme.md#custom-post-type-support
After that I've flushed my rewrite rules as they said. Unfortunately it doesn't work for my CPT. Only for normal posts.
I think it's because my CPT has no slug. The URL is the same as for posts: example.com/custom-post-type-post/
If I add a slug to the CPT, the AMP will work. But I couldn't do that.
Is there any other solution to fix this?