Hi Marco,
You don’t need to write any code for this because this option already available in our AMP plugin.
You can find that option by following the setting below.
AMP>setting>hide AMP bulk tool (http://take.ms/oqlIy)
By using this option you can hide amp by default on pages, but currently, we have a small bug in it.
I have made a ticket on GitHub and in our next update, we will be fixed it.
Here is the link to GitHub ticket: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/1537
-
This reply was modified 6 years, 1 month ago by Talha Ansari.
hi Talha,
thank you very much for the kind response.
Maybe I’ve not explained well my needs:
> all the pre-existent posts should maintain their settings
> when I create a new post, the setting Hide AMP must be set on HIDE
That said, if I use your tool (when it will be fixed), can you guarantee me that all the AMP version of the existent posts will be remain unaffected?
Hi Marco Panichi,
After selecting show by default or show by hide option from hide AMP bulk tool section it overwrites the previous setting so if you select a show by hide from the options panel then it overwrites existing as well as new page setting.
hi Talha,
thank you very much. It would have been a potential damage because we have lots of traffic coming from AMP pages.
So I have to proceed this way:
1) select hide by default option from hide AMP bulk tool
2) perform a query on the database in order to show those amp pages again on all posts created till now
Looking at the database, I’ve thought to a query like this one:
UPDATE wp_postmeta SET meta_value = “show_amp” WHERE meta_key = “ampforwp-amp-on-off”
What do you think about that procedure and the query?