Title: Problems making AMP extension load
Last modified: March 19, 2021

---

# Problems making AMP extension load

 *  Resolved [kushald](https://wordpress.org/support/users/kushald/)
 * (@kushald)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problems-making-amp-extension-load/)
 * We’re working with a partner who is trying to load amp-access-scroll by adding
   it in a filter like so.
 *     ```
       add_filter( 'amp_post_template_data', array( $this, 'amp_component_scripts' ), 99 );
   
       public function amp_component_scripts( $data = [] ) {
   
               $data['amp_component_scripts']['amp-access']        = 'https://cdn.ampproject.org/v0/amp-access-0.1.js';
               $data['amp_component_scripts']['amp-access-scroll'] = 'https://cdn.ampproject.org/v0/amp-access-scroll-0.1.js';
   
               return $data;
           }
       ```
   
 * However, amp-access loads but amp-access-scroll does not. Is it possible the 
   sanitizer is removing amp-access-scroll because there is no corresponding element
   or attribute to show that it is being used? If so, is there a way to override
   this behavior for our extension? Thanks!

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

 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problems-making-amp-extension-load/#post-14204995)
 * You no longer should need to manually add `amp_component_scripts` with such a
   filter. The plugin should be automatically adding the scripts when they are needed
   on the page. If the script is not needed on the page, then it is removed automatically.
 * If this is being removed even though you are adding it, then this is a bug in
   the detection logic.
 * Can you share the full markup that you are adding to the page which depends on
   this script component? I guess it is the `script#amp-access` element that goes
   in the `head` and then element that has the `amp-access="NOT scroll.scroll"` 
   attribute in the `body`? I admit I have no familiarity with this component, so
   if you can share how you’re intending to use it according to proper usage, that
   will be helpful.
 *  Thread Starter [kushald](https://wordpress.org/support/users/kushald/)
 * (@kushald)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problems-making-amp-extension-load/#post-14207829)
 * Thanks for the fast reply! Your guess is exactly right. And in particular there
   is no attribute or tag name that would help us know that we want to load the 
   Scroll extension without peeking into the two values you mention. I can’t share
   the code for the actual page in question, but conceptually it is the same as 
   [https://github.com/ampproject/amphtml/blob/master/examples/scroll.amp.html](https://github.com/ampproject/amphtml/blob/master/examples/scroll.amp.html)
 *  Thread Starter [kushald](https://wordpress.org/support/users/kushald/)
 * (@kushald)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problems-making-amp-extension-load/#post-14207930)
 * (It also looks like it’s possible to work around this issue for now by enqueuing
   this script tag in amp_post_template_head, is there any concern there we’re missing
   if we use this as a stopgap?)
    -  This reply was modified 5 years, 2 months ago by [kushald](https://wordpress.org/support/users/kushald/).
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problems-making-amp-extension-load/#post-14209463)
 * [@kushald](https://wordpress.org/support/users/kushald/) Yes, that will work 
   fine. You can also just output it the at the same point where you output the `
   section[amp-access]` element, and the AMP plugin will automatically move the 
   scripts to the `head`. That would have the advantage of not depending on the `
   amp_post_template_head` action, which is only applicable in the AMP Legacy template.
 * I’ve filed a bug for this: [https://github.com/ampproject/amp-wp/issues/5999](https://github.com/ampproject/amp-wp/issues/5999)
 *  Thread Starter [kushald](https://wordpress.org/support/users/kushald/)
 * (@kushald)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/problems-making-amp-extension-load/#post-14211456)
 * Got it, thank you!!

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

The topic ‘Problems making AMP extension load’ 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/)

 * 5 replies
 * 2 participants
 * Last reply from: [kushald](https://wordpress.org/support/users/kushald/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/problems-making-amp-extension-load/#post-14211456)
 * Status: resolved