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

admin_menu action hook #161

Closed
inspiraaz opened this issue Jan 27, 2015 · 2 comments
Closed

admin_menu action hook #161

inspiraaz opened this issue Jan 27, 2015 · 2 comments

Comments

@inspiraaz
Copy link

Is there any special reason why admin_menu hook is used to add metaboxes.
Isn't the add_meta_boxes hook more appropriate ?

@inspiraaz
Copy link
Author

Since this question makes no sense let me explain the issue i have.

I have a custom metabox ( not cmb2 ) that is initialized with add_meta_boxes hook.
And i want page elements to appear in this order...

content editor
my metabox
cmb2 metabox
other stuff ( author... )

I tried to change metabox priority and just can't set this order.
If cmb2 used the same hook ( add_meta_boxes ) i could set this order with hook priority.

@jtsternberg
Copy link
Member

This is a great question. I dug into git history, and it turns out, that hook was used from day one, the first commit. My guess is that the 'add_meta_boxes' hook was not very well-known at that point. I'll update in trunk to use this correct hook, and (if it doesn't break anything), will be in the next release.

jtsternberg added a commit that referenced this issue Feb 3, 2015
@jtsternberg jtsternberg reopened this Feb 3, 2015
pluginmirror-worker pushed a commit to wp-plugins/cmb2 that referenced this issue Feb 15, 2015
### Enhancements

* Use the more appropriate `add_meta_boxes` hook for hooking in metaboxes to post-edit screen. Thanks [@inspiraaz](https://github.com/inspiraaz) for reporting. ([#161](CMB2/CMB2#161))
* Add a `row_classes` field param which allows you to add additional classes to the cmb-row wrap. This parameter can take a string, or array, or can take a callback that returns a string or array. The callback will receive `$field_args` as the first argument, and the CMB2_Field `$field` object as the second argument. Reported/requested in [#68](CMB2/CMB2#68).
* New constant, `CMB2_LOADED`, which you can use to check if CMB2 is loaded for your plugins/themes with CMB2 dependency.
* New hooks, [`cmb2_init_before_hookup` and `cmb2_after_init`](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/filters-and-actions).
* New API for adding metaboxes and fields, demonstrated in [`example-functions.php`](https://github.com/WebDevStudios/CMB2/blob/master/example-functions.php). In keeping with backwards-compatibility, the `cmb2_meta_boxes` filter method will still work, but is not recommended. New API includes `new_cmb2_box` helper function to generate a new metabox, and returns a `$cmb` object to add new fields (via the `CMB2::add_field()` and `CMB2::add_group_field()` methods).
* New CMB2 method, [`CMB2::remove_field()`](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/filters-and-actions/cmb2_init_%24cmb_id-remove-field.php).
* New CMB2_Boxes method, [`CMB2_Boxes::remove()`](https://github.com/WebDevStudios/CMB2-Snippet-Library/blob/master/filters-and-actions/cmb2_init_before_hookup-remove-cmb2-metabox.php).
* When clicking on a file/image in the `file`, or `file_list` type, the media modal will open with that image selected. Props [johnsonpaul1014](https://github.com/johnsonpaul1014), ([#120](CMB2/CMB2#120)).

git-svn-id: https://plugins.svn.wordpress.org/cmb2/trunk@1090772 b8457f37-d9ea-0310-8a92-e5e31aec5664
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants