Error code
-
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]
-
What version of PHP are you running?
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.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.
Please determine the PHP version not the MySQL version. But in any case I cannot see what would be wrong here.
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 elementThe 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 AMPURL 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.
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.
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.
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.
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.
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”>
</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
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’sfunctions.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.
- The topic ‘Error code’ is closed to new replies.