| @@ -84,9 +84,10 @@ | ||
| 84 | 84 | return $this->is_amp_request() && ! $options['disable_amp']; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | - * Adds AMP actions. | |
| 88 | + * Adds AMP actions and deregisters any scripts that create AMP validation | |
| 89 | + * issues. | |
| 89 | 90 | * |
| 90 | 91 | * @since 2.6.0 |
| 91 | 92 | */ |
| 92 | 93 | public function add_actions(): void { |
| @@ -92,8 +93,18 @@ | ||
| 92 | 93 | public function add_actions(): void { |
| 93 | 94 | if ( $this->can_handle_amp_request() ) { |
| 94 | 95 | add_filter( 'amp_post_template_analytics', array( $this, 'register_parsely_for_amp_analytics' ) ); |
| 95 | 96 | add_filter( 'amp_analytics_entries', array( $this, 'register_parsely_for_amp_native_analytics' ) ); |
| 97 | + | |
| 98 | + // The tracker script isn't needed here, since tracking is done via | |
| 99 | + // the amp-analytics tag. Including the tracker creates an AMP | |
| 100 | + // validation issue. | |
| 101 | + wp_deregister_script( 'wp-parsely-tracker' ); | |
| 102 | + | |
| 103 | + // Our loader script creates an AMP validation issue, and it might | |
| 104 | + // not be useful under the AMP context. If we get feedback that it's | |
| 105 | + // needed, we can consider adding it under AMP. | |
| 106 | + wp_deregister_script( 'wp-parsely-loader' ); | |
| 96 | 107 | } |
| 97 | 108 | } |
| 98 | 109 | |
| 99 | 110 | /** |