Thanks, I Also Saw The Issue
Hi @halim81,
Thanks for letting us know about this. I also saw the issue that you saw.
It looks like the URL above is using the plugin “Page scroll to id” to render the shortcode:
https://ww.wp.xz.cn/plugins/page-scroll-to-id/
I think this occurs because the plugin “Page scroll to ID” calls add_shortcode() on the wp_enqueue_scripts action:
https://plugins.trac.ww.wp.xz.cn/browser/page-scroll-to-id/trunk/malihu-pagescroll2id.php#L373
This AMP plugin doesn’t run the wp_enqueue_scripts action in legacy templating (though it does in Paired Mode and Native AMP).
One fix for that plugin might be to run the shortcode logic on another hook, like ‘init’:
add_action( 'init', array( $this, 'add_plugin_shortcode' ) );
Steps To Reproduce
1. Create a post with this content:
Here's text above the shortcode.
<pre>[ps2id id="Ingredients" target=""/]</pre>
And below.
2. Activate the plugin “Page scroll to id”
3. Visit an AMP page, using legacy templating
Expected: The shortcode is evaluated, and not output literally
Actual: The shortcode is output literally:

Probably Won’t Work With AMP
Hi @halim81,
Sorry for not mentioning this earlier. But it looks like the “Page scroll to id” plugin relies on JavaScript files, which aren’t allowed in AMP. So even with the suggested change above, it probably won’t work with this plugin.
https://plugins.trac.ww.wp.xz.cn/browser/page-scroll-to-id/trunk/malihu-pagescroll2id.php#L166
Hi Ryan,
do you suggest any alternative to PS2id that can work with AMP?
Thanks
Halim
Possible Alternative
Hi @halim81,
You might be looking for the smooth scrolling that the “Page scroll to id” provides. I don’t know of another plugin that does that.
But you could probably get the same effect by editing the post content directly. For example, using the AMP page that you linked to above, you could hard-code the <a> elements in the post content (but remove target="_blank"):

Then, you could add the IDs to the elements that they should scroll to. For example, the “Overview”:
