• Resolved superandreescu

    (@superandreescu)


    I use ampforwp. I tried to hide share buttons in AMP pages like here https://docs.mashshare.net/article/126-disabling-mashshare-buttons-on-amp-pages but I received this PHP Fatal error: Uncaught Error: Call to undefined function is_amp_endpoint() in /home/public_html/wp-content/themes/../functions.php:49..

    Stack trace:
    #0 /home/public_html/wp-includes/class-wp-hook.php(286): do_not_show_amp_buttons(‘<aside class=”m…’)
    #1 /home/public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters(‘<aside class=”m…’, Array)
    #2 /home/public_html/wp-content/plugins/mashsharer/includes/template-functions.php(721): apply_filters(‘mashsb_output_b…’, ‘<aside class=”m…’)
    #3 /home/public_html/wp-content/plugins/mashsharer/includes/template-functions.php(977): mashshareShow()
    #4 /home/public_html/wp-includes/class-wp-hook.php(286): mashshare_filter_content(‘<p style=”text-…’)
    #5 /home/public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters(‘<p style=”text-…’, Array)
    #6 /home/public_html/wp-includes/post-template.php(247): apply_filters(‘the_content’, ‘<p style=”text-…’)

Viewing 1 replies (of 1 total)
  • This is an error in your code.
    You need to check first if the function exists before using it.

    Do it like this:

        if (  function_exists('is_amp_endpoint') && is_amp_endpoint()){
            // your code here
        }
Viewing 1 replies (of 1 total)
  • The topic ‘Hide on AMP pages’ is closed to new replies.