Skip to content
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

Masterbar: add_styles_and_scripts not added to admin_enqueue_scripts on Jetpack admin page #11081

Closed
jeherve opened this issue Jan 4, 2019 · 1 comment
Labels
Admin Page React-powered dashboard under the Jetpack menu [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Pri] BLOCKER [Type] Bug When a feature is broken and / or not performing as intended
Milestone

Comments

@jeherve
Copy link
Member

jeherve commented Jan 4, 2019

Steps to reproduce the issue

  1. Running master, go to Jetpack > Settings > Writing
  2. Enable the masterbar
  3. The page refreshes, but none of the masterbar scripts and styles are loaded on that page. They are loaded on all the other pages of the site.

image

@jeherve jeherve added [Type] Bug When a feature is broken and / or not performing as intended Admin Page React-powered dashboard under the Jetpack menu [Pri] BLOCKER [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations labels Jan 4, 2019
@jeherve jeherve added this to the 6.9 milestone Jan 4, 2019
@jeherve
Copy link
Member Author

jeherve commented Jan 4, 2019

This may be caused by the changes that were added in #10945

jeherve pushed a commit that referenced this issue Jan 8, 2019
<!--- Provide a general summary of your changes in the Title above -->

Fixes #11082 
Fixes #11081

#### Changes proposed in this Pull Request:

* Defer masterbar setup until the `wp` action, instead of doing the setup at the `init` action. This is needed because the `is_amp_endpoint()` function cannot be called before the `wp` action, as it needs access to the queried object.

#### Testing instructions:
<!-- Please include detailed testing steps, explaining how to test your change. -->
<!-- Bear in mind that context you working on is not obvious for everyone.  -->
<!-- Adding "simple" configuration steps will help reviewers to get to your PR as quickly as possible. -->
<!-- "Before / After" screenshots can also be very helpful when the change is visual. -->

1. Ensure Jetpack's masterbar module is active.
2. Activate the AMP plugin v1.0.1
3. Enable the new paired mode via the AMP settings.
4. Navigate to a singular post.

Without the changes in this PR, there should be two PHP notices being raised:

```
( ! ) Notice: Trying to get property 'post_type' of non-object in .../amp/includes/class-amp-post-type-support.php on line 80

( ! ) Notice: Trying to get property 'ID' of non-object in .../amp/includes/class-amp-post-type-support.php on line 101
```

See also ampproject/amp-wp#1794 which will catch the incorrect usage of `is_amp_endpoint()`.

#### Proposed changelog entry for your changes:
<!-- Please do not leave this empty. If no changelog entry needed, state as such. -->

* Fix AMP integration with masterbar module.
jeherve pushed a commit that referenced this issue Jan 8, 2019
<!--- Provide a general summary of your changes in the Title above -->

Fixes #11082 
Fixes #11081

#### Changes proposed in this Pull Request:

* Defer masterbar setup until the `wp` action, instead of doing the setup at the `init` action. This is needed because the `is_amp_endpoint()` function cannot be called before the `wp` action, as it needs access to the queried object.

#### Testing instructions:
<!-- Please include detailed testing steps, explaining how to test your change. -->
<!-- Bear in mind that context you working on is not obvious for everyone.  -->
<!-- Adding "simple" configuration steps will help reviewers to get to your PR as quickly as possible. -->
<!-- "Before / After" screenshots can also be very helpful when the change is visual. -->

1. Ensure Jetpack's masterbar module is active.
2. Activate the AMP plugin v1.0.1
3. Enable the new paired mode via the AMP settings.
4. Navigate to a singular post.

Without the changes in this PR, there should be two PHP notices being raised:

```
( ! ) Notice: Trying to get property 'post_type' of non-object in .../amp/includes/class-amp-post-type-support.php on line 80

( ! ) Notice: Trying to get property 'ID' of non-object in .../amp/includes/class-amp-post-type-support.php on line 101
```

See also ampproject/amp-wp#1794 which will catch the incorrect usage of `is_amp_endpoint()`.

#### Proposed changelog entry for your changes:
<!-- Please do not leave this empty. If no changelog entry needed, state as such. -->

* Fix AMP integration with masterbar module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin Page React-powered dashboard under the Jetpack menu [Feature] Masterbar WordPress.com Toolbar and Dashboard customizations [Pri] BLOCKER [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

1 participant