| 开发者 |
mohsinrafique
pixelative |
|---|---|
| 更新时间 | 2026年5月30日 07:08 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
mohsin.rafique@gmail.com to contribute translationsAMP WP supports two URL formats:
https://yoursite.com/amp/page-namehttps://yoursite.com/page-name/ampGo to AMP WP -> Settings -> Analytics in your WordPress admin dashboard. AMP WP supports Google Analytics, Facebook Pixel, Segment, Quantcast, Alexa Metrics, Chartbeat, comScore, Yandex Metrica, AFS Analytics, and Adobe Analytics.
This is usually caused by inconsistent thumbnail sizes. Install and run Regenerate Thumbnails to normalize all image sizes.
Yes. Since version 1.6.0, AMP WP supports Instagram /p/, /reel/, and /tv/ post types natively via amp-instagram.
Two layouts are included: Classic View and List View. Switch between them from AMP WP -> Options Panel.
Go to Dashboard -> AMP WP -> Customize AMP. You can inject valid AMP snippets:
<head></head> tags<body> opening tag</body> closing tag
Only valid, AMP-compatible code will function on AMP pages.Recommended path (AMP WP 1.7.7 and later):
amp-auto-ads runtime loader (<script async custom-element="amp-auto-ads" src="https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js"></script>) is injected inside <head> via the canonical AMP component pipeline.<amp-auto-ads type="adsense" data-ad-client="ca-pub-XXXXXXXXXXXXXXXX"> element is emitted right after <body> so the AMP validator sees the extension as "used" and AdSense can place anchor, vignette, and in-page ads.ca-pub-... value via the amp_wp_adsense_publisher_id filter. Drop this into your theme's functions.php or a small mu-plugin:add_filter( 'amp_wp_adsense_publisher_id', function() { return 'ca-pub-XXXXXXXXXXXXXXXX'; } );
The filter accepts any of the three plausible input shapes - ca-pub-XXXX, pub-XXXX, or the bare numeric ID - and AMP WP normalises the value before output. If no publisher ID is resolvable, AMP WP silently skips the body-side element so the page stays validator-clean.
Manual fallback (non-AdSense ad networks, custom snippets):
Navigate to Dashboard -> AMP WP -> Customize AMP. Paste the runtime loader script in the "Codes between <head> and </head> tags" field, and your <amp-auto-ads> (or other AMP-valid ad markup) in the "Codes right after <body> tag" field. When you later enable the native Google Auto Ads toggle, AMP WP auto-cleans any manually-pasted amp-auto-ads loader from the head-code field and surfaces a one-shot admin notice confirming the cleanup, so the native injection path remains the single source of truth.
AdSense Auto Ads for AMP - Google Help
Edit the post in WordPress, scroll to the AMP WP meta box in the sidebar, and toggle the AMP option on or off for that individual post.
Please email mohsin.rafique@gmail.com or open a thread on the WordPress support forum.
rgb()/rgba() values to integers and strips attr() / type() (CSS Level 5) declarations. Resolves the "CSS syntax error in tag style amp-custom" validation error caused by WordPress 7.0 view-transitions CSS and Dart Sass compiled stylesheets.
Improvements
amp-wp text domain on two untranslated option labels, and switched loose comparisons to strict - select dropdowns now use === against their string values while on/off toggles use ! empty() (avoids the int-vs-string trap where a saved 1 would not match '1' under ===). No behaviour change.start-point / end-point) to strict ===, and defaulted the variables the view receives from its controller (null-coalescing to the controller's own defaults) so the template also resolves cleanly under static analysis. No behaviour change.ABSPATH guard below the file docblock where it had been inlined on the opening tag, and terminated inline/param comments. No behaviour change.translators: comments for the placeholder strings "Reply To %s" and "Page %1$s of %2$s" so the placeholders are documented for translators. No behaviour change.@param PHPDoc blocks on the amp_wp_settings_tab_menus (class-amp-wp-settings.php) and amp_wp_welcome_tab_menus (class-amp-wp-welcome.php) filters (invalid array (){ hash notation that broke static analysis) and corrected an @Since tag typo. No behaviour change.@ error-suppression on ini_get(). No behaviour change.@view-transition validation error on WordPress 7.0 sites with View Transitions enabled, covering head <style> extraction plus input-layer and output-layer stripping.<style amp-custom> (@view-transition, @import, @charset, @namespace, @layer), including when nested inside @media or @supports. Resolves the @view-transition error added by WordPress 7.0 global styles.Amp_WP_Html_Util::set_outer_HTML() now replaces the target element in place instead of wiping surrounding markup. Fixes SoundCloud iframe embeds destroying sibling elements.
WordPress Compatibility (Compat)
<amp-auto-ads type="adsense"> body element automatically when "Google Auto Ads" is enabled, completing turnkey Auto Ads support. The publisher ID is auto-resolved from Google Site Kit, or supplied via the new amp_wp_adsense_publisher_id filter. New public functions amp_wp_get_adsense_publisher_id() and amp_wp_render_auto_ads_element().
Fixed
amp-auto-ads runtime loader via the canonical AMP component pipeline, so the script no longer needs to be pasted into the Customizer head-code field. Any manually pasted loader is auto-cleaned on save.
Fixed
<amp-geo> was emitted as a corrupted HTML-encoded string, causing the AMP runtime to reject the config and silently disable the geo-gated banner. It is now emitted as valid JSON.
Refactored
amp_wp_register_premium_extension() and amp_wp_register_template_path() so family add-ons can self-register and ship their own AMP templates.amp_wp_layout_setting_after_show_comments for add-ons to extend the comment settings block.
Security
phpcs:ignore annotations. The escaping, nonce, and sanitize sniffs now report zero errors (down from 311). No behaviour change.
Fixed
/favicon.ico and other root-level static-file requests on mobile no longer redirect to /<file>/amp and 404.
/shop/amp/page/2/).302 plus no-cache headers, with a one-shot Clear-Site-Data to recover clients holding a stale 301.amp-state elements are no longer stripped when the AMP WP Comments add-on is active.wp_safe_redirect(). No public-API change.
tools/test-redirects.sh curl smoke harness for verifying redirect behaviour before release.<amp-img> / <amp-anim>). A dedicated sanitizer now preserves the logo markup.WPFORO_VERSION.image fallback.
Improvements
G-XXXXXXXX) IDs now use the correct amp-analytics tag, fixing the post-migration console warning./uk/category/post/amp/) no longer 404.?amp_refresh_versions=1 forces a refresh.wp_safe_redirect() plus exit.
amp_wp_version_check_using_wpapi() guarded against duplicate inclusion.$page warning in the admin header.
For the complete version history (1.6.0 and all earlier releases, in full detail), see the changelog.txt file included with the plugin.