Question About 404 Error, Suggestion For ‘post’ AMP Pages
Hi @helene-roux-photo,
Sorry you got a 404 error. That’s frustrating, and I understand why you’d delete the plugin.
Where was that 404, on a post or a page? And did you see any PHP errors?
Thanks for suggesting that we have an option to not use AMP for posts.
Here’s a way to not have AMP display by default on posts, only on pages. This could go in your theme’s functions.php
file, or a custom plugin.
/**
* Prevents posts from having an AMP page by default.
*
* This doesn't affect other post types, like 'page.'
* And you can still override this default in the post's 'Publish' meta box.
*
* @return boolean $default Whether to support the $post by default.
*/
add_filter( 'amp_post_status_default_enabled', function( $default, $post ) {
if ( 'post' === $post->post_type ) {
return false;
}
return $default;
}, 10, 2 );
This uses a slightly-modified snippet from this wiki page:
https://github.com/Automattic/amp-wp/wiki/Custom-Post-Type-Support
If you’re willing, I’d like to help you get setup with this plugin again.