Title: Plugin not converting wp_get_attachment_image()
Last modified: August 29, 2019

---

# Plugin not converting wp_get_attachment_image()

 *  Resolved [niftyjohn](https://wordpress.org/support/users/niftyjohn/)
 * (@niftyjohn)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/)
 * I’m using wp_get_attachment_image() and wp_get_attachment_image_src() methods
   inside shortcodes to make my sites much more modular. However, the plugin is 
   not switching  to the amp version so no images are populating. This not a thing
   for the plugin or just an oversight? Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-not-converting-wp_get_attachment_image%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 11 replies - 1 through 11 (of 11 total)

 *  [James Osborne](https://wordpress.org/support/users/jamesosborne/)
 * (@jamesosborne)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11880429)
 * [@niftyjohn](https://wordpress.org/support/users/niftyjohn/) I can see some validation
   errors but not related to images, they are related to iFrames, with references
   to the Gravity Forms plugin. This could be similar to [this](https://wordpress.org/support/topic/gravity-form-with-amp/)
   previous post, which contains a potential fix.
 * It might also be worth looking at [this](https://github.com/ampproject/amp-wp/issues/1521)
   Github issue.
 * Can you check if the errors appear with any of your Gravity Forms disabled? You
   might also want to disable any other AMP plugin if you have them active.
 *  Thread Starter [niftyjohn](https://wordpress.org/support/users/niftyjohn/)
 * (@niftyjohn)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11880452)
 * The images aren’t loading on the frontend at all and are stripped out. Look at
   divorce-matters.com to see the live version of how it should be looking. Here’s
   the backend error within the plugin for all images on the page: [https://divorcematters.staging.wpengine.com/wp-content/uploads/2019/08/Screen-Shot-2019-08-29-at-10.25.09-AM.jpg](https://divorcematters.staging.wpengine.com/wp-content/uploads/2019/08/Screen-Shot-2019-08-29-at-10.25.09-AM.jpg)
 * I haven’t gotten to the gforms issue yet but it could be because I have gforms
   nested inside another shortcode?
 *  Thread Starter [niftyjohn](https://wordpress.org/support/users/niftyjohn/)
 * (@niftyjohn)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11880683)
 * Ok, I read through the gforms resources. Takeaways: you guys won’t be directly
   support gforms, there might be methods to fixing them but it’ll be through custom
   coding via gforms methods.
 * That’s great. New question that is related to both. Is there a hook or global
   var that I can use to run code only on AMP? I haven’t discovered one yet and 
   I didn’t notice a direct one in the documentation.
 * This is useful for me so that I can custom fix my img tags and gforms without
   compromising the desktop experience, directly or indirectly. Thanks!
 *  Thread Starter [niftyjohn](https://wordpress.org/support/users/niftyjohn/)
 * (@niftyjohn)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11880730)
 * I think I just found it on [https://xwp.github.io/amp-wp/](https://xwp.github.io/amp-wp/).
   This the intended method if it’s a AMP page? is_amp_endpoint()
 * If it is, any assistance with the image problem would be great! Thanks!
 *  [James Osborne](https://wordpress.org/support/users/jamesosborne/)
 * (@jamesosborne)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11881068)
 * [@niftyjohn](https://wordpress.org/support/users/niftyjohn/) You’ll find more
   on the is_amp_endpoint on the [plugin website](https://amp-wp.org/documentation/developing-wordpress-amp-sites/how-to-develop-with-the-amp-plugin/).
   But yes, it can be used for AMP URLs only.
 * In relation to your image issue I can see the img markup only in your [non AMP](https://i.imgur.com/5dcRkII.png).
   Did you add some functions or a plugin which might be impacting this? Maybe try
   activate another theme and deactivate any image optimisation plugins in use before
   checking again.
 *  Thread Starter [niftyjohn](https://wordpress.org/support/users/niftyjohn/)
 * (@niftyjohn)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11881220)
 * So, the theme I’m using is a heavily modified version of TwentyNineteen. I have
   shortcodes for sections that get_template_part() where the rest of the code is
   stored in basically raw HTML & PHP. So, in these files I’m simply using doing
   this:
 * <?= wp_get_attachment_image(36, ‘full’, false, array(‘alt’ => ’10 best client
   satisfaction, American Institute of Family Law Attorney’)); ?>
 * I have that directly in my header.php file and it’s not working for the logo 
   next to the nav. I don’t think this is isolated to the shortcodes.
 * —
    Good thought; I do have Optimole but it hasn’t been active on the staging 
   site at all.
 *  [James Osborne](https://wordpress.org/support/users/jamesosborne/)
 * (@jamesosborne)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11883614)
 * [@niftyjohn](https://wordpress.org/support/users/niftyjohn/) I don’t think the
   issue is just related to your images, the content inside your [header tags](https://i.imgur.com/gyMWtkV.png)
   are also not visible on your AMP URLs.
 * How are you using `is_amp_endpoint()` to restrict any content on AMP, can you
   share any functions which may be impacting these issues?
 *  Thread Starter [niftyjohn](https://wordpress.org/support/users/niftyjohn/)
 * (@niftyjohn)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11883956)
 * I’m actually not using the method at all in the theme right now. I simply added
   the plugin and here are my [plugin settings](https://divorcematters.staging.wpengine.com/wp-content/uploads/2019/08/Screen-Shot-2019-08-30-at-8.37.26-AM.jpg).
 * I’m trying to use as little custom code as possible for AMP because I have a 
   few hundred to roll this out to once I get it nailed down.
 *  [James Osborne](https://wordpress.org/support/users/jamesosborne/)
 * (@jamesosborne)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11884200)
 * I can see some references to lazy loading on some of your images, a `lazyload`
   class. Are you using any additional plugin? If you can share your [site health information](https://i.imgur.com/Rtkmsba.png)
   I can see if I notice anything.
 *  Thread Starter [niftyjohn](https://wordpress.org/support/users/niftyjohn/)
 * (@niftyjohn)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11884358)
 * Woah! Thank you for noticing that! Our team built a custom lazy loader that’s
   much more stable than seemingly anything else out there. I needed to turn off
   that function if it was an AMP page. Thank you!
 *  [James Osborne](https://wordpress.org/support/users/jamesosborne/)
 * (@jamesosborne)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11884458)
 * Great news, and nice work on the site, in `transitional` too. Feel free to leave
   the plugin a review if you find you are benefiting from it.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Plugin not converting wp_get_attachment_image()’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

## Tags

 * [ajax](https://wordpress.org/support/topic-tag/ajax/)
 * [iframe](https://wordpress.org/support/topic-tag/iframe/)
 * [images](https://wordpress.org/support/topic-tag/images/)

 * 11 replies
 * 2 participants
 * Last reply from: [James Osborne](https://wordpress.org/support/users/jamesosborne/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/plugin-not-converting-wp_get_attachment_image/#post-11884458)
 * Status: resolved