If you are developing some code and you want to detect if it’s AMP then you can use the below code.
if ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) { }
Warning: is_amp_endpoint() is depreciated from AMPforWP
If you are facing any warnings in the debug log or on the website like
Notice: is_amp_endpoint was called <strong>incorrectly</strong>. is_amp_endpoint() is deprecated from AMPforWP, please use ampforwp_is_amp_endpoint instead. Please see <a href=”https://codex.wordpress.org/Debugging_in_WordPress”>Debugging in WordPress</a> for more information.
Then to solve this warning, go to the path mentioned in the warning and find is_amp_endpoint and replace it with ampforwp_is_amp_endpoint
This will fix the warnings.
Hope it helps. If you have any questions, then please ask us in the below comments.
Hello, I have the following error message on my website (this page for example : https://radinmalinblog.com/5-astuces-efficaces-pour-remplacer-le-sopalin )
Notice: is_amp_endpoint est appelée de la mauvaise manière. is_amp_endpoint() is deprecated from AMPforWP, please use ampforwp_is_amp_endpoint instead. Check https://ampforwp.com/tutorials/article/detect-amp-page-function/ for more info Veuillez lire Débogage dans WordPress (en) pour plus d’informations. (Ce message a été ajouté à la version 5.1.1.) in /homepages/37/d574216427/htdocs/clickandbuilds/WordPress/MyCMS2/wp-includes/functions.php on line 4667
Problem is, on functions.php there is no mention of ampforwp either at line 4667 nor in the rest of the document. Thus, I couldn’t find is_amp_endpoint and replace it with ampforwp_is_amp_endpoint as you instructed in your help section.
This happened after I updated to WP 5.1.1
I have de-activated the plug-in AMP for WP for the moment.
Thank you!
Hi Marc,
Please contact our support team from here – https://ampforwp.com/support/ and they will help you to fix the issue as soon as possible.
if ( function_exists( ‘ampforwp_is_amp_endpoint’ ) && ampforwp_is_amp_endpoint() ) {
}
this code does not work… crashes WordPress..
Hi Bahadır Çolak,
Will you please contact our technical team from here- https://ampforwp.com/support/ and they will help you to fix the issue.