1. Home
  2. Developer Docs
  3. General
  4. Displaying “Custom AMP editor” Content through php code

Displaying “Custom AMP editor” Content through php code

All the content added in the “Custom AMP editor” will be saved in post meta.

If you want to fetch the data from Custom AMP editor then use below the function

get_post_meta() is a function and in that we’re passing 3 parameter

If you want to know more about get post meta then you can check this official documentation


 get_post_meta( int $post_id, string $key = '', bool $single = false ) 

get_post_meta(ampforwp_get_the_ID,’ampforwp_custom_content_editor’, true ) ;


  • get_the_ID: By using this parameter you can retrieve the ID of the current item in the WordPress Loop
  • ampforwp_custom_content_editor: By using this key you can fetch the data saved in Custom AMP Content
  • true: By default this value is false

This is the example of Code

 $data = get_post_meta(ampforwp_get_the_ID,'ampforwp_custom_content_editor', true );
echo $data;

That’s it for this tutorial!

We hope it helped you. If you have any feedback or questions, then please share them in the comments section below..

Ask your Questions Directly!
If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!
Updated on May 7, 2020

Was this article helpful?

Related Articles


    1. Hi Rajat,

      If you want to add PHP in the AMP version then you can just create a new file or even you can write in your functions.php of your theme and in that you need to use our hooks and filters, for example, we have a hook called “pre_amp_render_post” you can use this hook and add code that will only appear in amp. we already have a lot of hooks here – you can use it according to you

Leave a Comment