-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix the issue of submenus not appearing #40
Conversation
Now, on the first installation, the submenus appear.
This reverts commit 90232a9.
The previous approach didn't work, as it gave the capabilities to more than admin users. Adding these custom capabilities on the plugins_loaded action looks to work.
@@ -47,7 +47,7 @@ public function __construct() { | |||
*/ | |||
public function register_hooks() { | |||
add_action( 'init', [ $this, 'register_post_type' ] ); | |||
add_action( 'admin_init', [ $this, 'add_caps' ] ); | |||
add_action( 'plugins_loaded', [ $this, 'add_caps' ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe admin_init
was a little too late to add the capabilities.
By moving it earlier to plugins_loaded
, the capability is there in time for the submenus to be there.
It should also be possible to revert #23 |
The same issue that caused the submenus to not display also caused the link to not display. Now that the capability is added earlier, this works.
Hi @mindctrl and @nickcernis, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks so much for reviewing this! |
Changes
Ensures that on first activation, the block CPT menus appear:
This bug only appeared the first time GCB is ever activated on the site.
Testing instructions