-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AMP: load order issues #11169
Comments
cc @westonruter Moving things from |
If plugins rely on an early hook to initialize (like Jetpack), then yes, this will be something needing to be worked through. The AMP plugin has always required the While Ultimately, the solution is to delay initialization of the modules or defer the |
Thanks, that makes sense! Do you think something like 29a3558 would be enough to solve our issues here? |
@jeherve The change to A normal refactor would look like this. Given this code: add_action( 'init', function() {
if ( ! is_amp_endpoint() ) {
add_filter( 'something', 'filter_something' );
}
} );
function filter_something( $value ) {
$value .= 'something else';
return $value;
} This should be changed rather to be: add_action( 'init', function() {
add_filter( 'something', 'filter_something' );
} );
function filter_something( $value ) {
if ( ! is_amp_endpoint() ) {
$value .= 'something else';
}
return $value;
} So essentially the AMP checks should be deferred to as late as possible. |
Summary: After adding the AMP compat file that ships with Jetpack (this was done in D22313, D26814, D26819, D26921, and D26928), let's start using this class. This replaces D22154 and D23501, and allows us to start syncing any future changes that would rely on the Jetpack_AMP_Support class. Related Jetpack PRs: - #10945 - #11195, which reverted some of the changes in the PR above. - #12054 - #12053 - #12026 Discussion: - https://[private link] We'll need to test for issues like the ones that popped up on Jetpack at the time: #11169 We will also need to account for the fact that WordPress.com does not run the latest version of the AMP plugin. It runs an old version (0.6.2 vs. the current version on W.org 1.0.2), with its own version of some of the compatibility fixes that come with the class we've added (see [[ https://[private link].php | here ]]) and needs to be updated as per the discussions here: - https://[private link] (D14521) - https://[private link] Test Plan: * Create a post with a gallery * Add a Facebook sharing button to that post. * Try Liking that post. * Comment on one of the images in the gallery. * Load the post in an AMP view, and repeat the steps below. In all cases: - You should not see any js errors in the browser console. - You should not get any PHP notices in your debug log. Reviewers: zinigor Tags: #touches_jetpack_files Differential Revision: D26821-code This commit syncs r190790-wpcom.
Summary: After adding the AMP compat file that ships with Jetpack (this was done in D22313, D26814, D26819, D26921, and D26928), let's start using this class. This replaces D22154 and D23501, and allows us to start syncing any future changes that would rely on the Jetpack_AMP_Support class. Related Jetpack PRs: - #10945 - #11195, which reverted some of the changes in the PR above. - #12054 - #12053 - #12026 Discussion: - https://[private link] We'll need to test for issues like the ones that popped up on Jetpack at the time: #11169 We will also need to account for the fact that WordPress.com does not run the latest version of the AMP plugin. It runs an old version (0.6.2 vs. the current version on W.org 1.0.2), with its own version of some of the compatibility fixes that come with the class we've added (see [[ https://[private link].php | here ]]) and needs to be updated as per the discussions here: - https://[private link] (D14521) - https://[private link] Test Plan: * Create a post with a gallery * Add a Facebook sharing button to that post. * Try Liking that post. * Comment on one of the images in the gallery. * Load the post in an AMP view, and repeat the steps below. In all cases: - You should not see any js errors in the browser console. - You should not get any PHP notices in your debug log. Reviewers: zinigor Tags: #touches_jetpack_files Differential Revision: D26821-code This commit syncs r190790-wpcom.
Opening this to track the different issues that were caused by #10945 in Jetpack 6.9. We'll need to find a different solution to address the solution proposed in this PR, as it caused problems with different modules:
The text was updated successfully, but these errors were encountered: