Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

wpcom_vip_load_gutenberg doesn't allow meta boxes to be loaded #69

Closed
andrewfleming opened this issue Sep 12, 2018 · 3 comments
Closed
Milestone

Comments

@andrewfleming
Copy link

Originally reported by @micahwave

The priority of the plugins_loaded hooks is currently set in a way that makes it so no custom meta boxes get loaded.

If you use wpcom_vip_load_gutenberg, it's going to enable gutenberg here:

add_action( 'plugins_loaded', [ $this, 'load_decision' ], 20, 0 );

The issue is that gutenberg itself registers a plugins_loaded hook at a lower priority:

https://github.com/WordPress/gutenberg/blob/master/lib/register.php#L27

With the current setup, the gutenberg_trick_plugins_into_registering_meta_boxes function is never called because ramp isn't activated in time.

If you change the load_decision hook priority to 5 it seems to fix the issue.

@micahwave
Copy link

Here's a PR that fixes this issue: #68

@pyronaur
Copy link
Member

It seems to me that the priority 20 wasn't an accident, but rather added deliberately, so I think it'd be best not to tamper with the priority

The Gutenberg plugin meta box trick comment says that it's trying to register as late as possible, but it's not clear to me whether plugins_loaded, priority = 10 is as late as possible or whether the priority wasn't considered. If the priority wasn't considered - we could patch this either directly in Gutenberg or by removing and re-adding that function on a later stage of plugins_init, like priority 1000.

I tried reaching @BE-Webdesign on the Gutenberg repository WordPress/gutenberg#2804 two weeks ago, but haven't yet received a response, which is why this issue is a bit delayed.

@micahwave if this is a time pressing issue for you - you could try to remove and re-add technique in your own project - that wouldn't require direct modification of neither Ramp nor Gutenberg. If you do try it - please let me know the results and whether or not something broke as a result of that.

@maevelander
Copy link
Contributor

This issue is resolved by #70 - the plugins_loaded hook priority no longer exists in 1.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants