• Resolved ThecounT

    (@thecount)


    Warning: preg_replace_callback(): Requires argument 2, ”, to be a valid callback in /home/thecount/public_html/wp-content/plugins/amp/includes/utils/class-amp-dom-utils.php on line 264

    Thanks!

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    What version of PHP are you running?

    Plugin Author Weston Ruter

    (@westonruter)

    Source code for where the error is coming from: https://github.com/Automattic/amp-wp/blob/d9b20172406844b66e0732e2a2e4d6e512042eb4/includes/utils/class-amp-dom-utils.php#L264

    I don’t see why $replace_callback, a closure, would be an invalid callback.

    Thread Starter ThecounT

    (@thecount)

    Ok thank you very much for your time. I am waiting on server team to tell me sql version.

    Is there any other info I can provide you to help you? I am using twenty eleven theme. centos 5.

    Plugin Author Weston Ruter

    (@westonruter)

    Please determine the PHP version not the MySQL version. But in any case I cannot see what would be wrong here.

    Thread Starter ThecounT

    (@thecount)

    OK sorry about that erroneous information. The server is currently running on php version PHP 5.4.45.

    I will say, this issue popped up with an update to the plugin time before last I believe. We had no issues with the plugin up to that time. Then we start receiving email from google advising of error issues with amp that might also effect search results. Again, we did not change anything on our end, only faithfully updated your plugin as prompted.

    After update, on Feb 14, we started receiving emails from googs…

    “Search Console has identified that your site is affected by 5 new Accelerated Mobile Pages related issues. This means that Accelerated Mobile Pages may be negatively affected in Google Search results. We encourage you to fix these issues.

    Top 5 new issues found, ordered by number of affected pages:
    Error in required structured data element

    The inline ‘style’ attribute is not allowed in AMP documents, use ‘style amp-custom’ tag instead

    Tag or text which is only allowed inside the body section found outside of the body section

    The tag ‘BODY’ appears more than once in the document.

    Invalid URL for HTML attribute ‘href’ in tag ‘a'”

    Then more email with different error alerts/ warnings on Feb 17, May 9, June 25.

    And then one today:

    Search Console has identified that your site is affected by 2 new AMP related issues. This means that AMP may be negatively affected in Google Search results. We encourage you to fix these issues.

    Top new issues found, ordered by number of affected pages:
    Referenced AMP URL is not an AMP

    URL not found (404)

    Again, all we did was update plugin which was operating fine before. I am going to disable at this point and I again thank you for your time and efforts on this plugin. I am excited to see this resolved.

    • This reply was modified 6 years, 8 months ago by ThecounT.
    • This reply was modified 6 years, 8 months ago by ThecounT.
    Plugin Author Weston Ruter

    (@westonruter)

    PHP 5.4 is quite an old version. I suggest you upgrading to a more recent version, at least 5.6. That could resolve this issue for you. You will also see performance improvements on your site when you upgrade to a newer version of PHP, as well as having better security with a currently-supported PHP version.

    Thread Starter ThecounT

    (@thecount)

    Ok thank you very much for that. I contacted server team and they are upgrading me to CentOS 7, which will allow newer PHP version. If I get enhanced performance through process that will be a nice bonus and maybe even the silver lining to all this.

    The process will take some time so I will hit you back to let you know if upgrade fixed issue at hand.

    Again, thank you for your valuable time and have a wonderful day.

    Thread Starter ThecounT

    (@thecount)

    Hi Weston, I received the CentOS 7 upgrade and your plugin now works perfectly. Thank you for all your valuable help.

    May I ask on another note, is the amp single page the best place to place the adsense smart ad code? I placed the code there but I am not yet seeing anything showing up.

    Plugin Author Weston Ruter

    (@westonruter)

    What code specifically? The amp-auto-ads component? Note that we’ve seen ads get served for mobile with ads for desktop coming later.

    Sharing a URL would be helpful.

    Thread Starter ThecounT

    (@thecount)

    Hey thanks Weston.

    via adsense:

    “Copy and paste this script in the head tag of your AMP HTML”

    <script async custom-element=”amp-auto-ads”
    src=”https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js”&gt;
    </script>

    “Copy and paste this ad code in the body of your AMP HTML”

    <amp-auto-ads type=”adsense”
    data-ad-client=”ca-pub-XXXXXXXXXXXXX”>
    </amp-auto-ads>

    Sure! TheCount.com

    Plugin Author Weston Ruter

    (@westonruter)

    It may be that ads are just not being served on desktop yet. We’ve noticed desktop ads take longer to start serving. Did you check mobile? See also https://github.com/Automattic/amp-wp/issues/1258

    Also, you should not add the amp-auto-ads script in that way. This has the potential for duplicates to occur, if other plugins try to add the same script. Instead, you should put the following in your theme’s functions.php or a plugin:

    add_filter( 'amp_post_template_data', function( $data ) {
    	$data['amp_component_scripts'] = array_merge(
    		$data['amp_component_scripts'],
    		array(
    			'amp-auto-ads' => 'https://cdn.ampproject.org/v0/amp-auto-ads-latest.js',
    		)
    	);
    	return $data;
    } );

    Note that this is unnecessary if you use the new AMP theme support.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Error code’ is closed to new replies.