• Resolved Amar Ilindra

    (@amarilindra)


    I got 12 AMP errors in my Console and on further investigation, I noticed WP App Box is adding following script at the beginning of the page. BEFORE STARTING THE <HEAD> TAG

    This is the script

    <script type=”text/javascript”>var wpappbox_combined_button = {“names”:[“Amazon Apps”,”(Mac) App Store”,”Chrome Web Store”,”Firefox Add-ons”,”GOG.com”,”Google Play Apps”,”Opera Add-ons”,”Steam”,”Windows Store”,”WordPress Plugins”,”XDA Labs”],”ids”:[“amazonapps”,”appstore”,”chromewebstore”,”firefoxaddon”,”goodoldgames”,”googleplay”,”operaaddons”,”steam”,”windowsstore”,”wordpress”,”xda”]};</script>

    I found this problem only on few pages of my website and in rest of the pages this same script was added below <title> tag and works fine.

    Here is the screenshot
    https://www.dropbox.com/s/w4y3znj0cxm8iq3/view-source%3Ahttps%3A%3A%3Awww.geekdashboard.com%3Abest-ocr.png?dl=0

    Note: I manually removed the code inside wp-appbox.php file (lines 826 and 867) to fix the problem temporarily. Still, pages loads fine without this script. Can I know what does this script do and why only few pages are affected?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Marcelismus

    (@marcelismus)

    This should not appear in the code at all, because it is code for the editor buttons and the code is only loaded in the admin backend. I don’t know why your AMP plugin gets the code or the WordPress filter “mce_buttons”. Or do you use Andy “front end editor”-plugin on this pages?

    Did you remove lines 826 and 867 (so no single button in the editor) or 810-830? Would be nice if you could try to remove lines 810-830 only (and left lines 826 and 867 in).

    • This reply was modified 6 years, 3 months ago by Marcelismus.
    • This reply was modified 6 years, 3 months ago by Marcelismus.
    Thread Starter Amar Ilindra

    (@amarilindra)

    Hi

    After updating your plugin, I noticed the same issue. I made my hands dirty and found the problem with your code.

    I understood it is not an issue with my AMP plugin. The actual issue is in function ‘wpAppbox_addButtonsWYSIWYG’ at line 866 of wp-appbox.php file.

    You are directly adding the <script> into the source code. It is a bad practice.

    You need to use ‘admin_head’ action to add any scripts to header in admin area pages.

    For now, I removed this filter to fix the problem.
    add_filter( ‘mce_buttons’, ‘wpAppbox_addButtonsWYSIWYG’, 0 );

    The same problem is in ‘wpAppbox_addCombinedButton’ function and luckily this function is commented/never called.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding tables above and makes AMP invalid’ is closed to new replies.