-
Notifications
You must be signed in to change notification settings - Fork 570
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
WP REST API shows all metaboxes for all custom post types #1158
Comments
I can confirm this issue, I am working for a project to redo all the endpoint to avoid this problem. |
Seems that https://github.com/CMB2/CMB2/blob/develop/includes/rest-api/CMB2_REST.php#L404 rest_box include the right metabox but read_fields return all the fiedls also of other metabox |
2 tasks
And I did a pr with the bugfix #1238 :-) |
lipemat
added a commit
to lipemat/CMB2
that referenced
this issue
Apr 28, 2020
* upstream/develop: (93 commits) Ensure to enqueue wp-color-picker Add props for CMB2#1331 Update "develop" bootstrap classname Proposal of CODE OF CONDUCT File Update version/copyright in scripts/stylesheets Fix issues with some tests to get them all passing `CMB2::is_box_type()` now also checks for taxonomies if box is registered to "term" object type. Prepare for 2.7.0 release Add all missing props/udpates to changelog bump tested-to value Rename CMB2_hookup to CMB2_Hookup Fixes CMB2#1328 Validate composer.json Tested Up To confirmations. Update issue templates Add license file to meet Community standards Add changelog for the register_rest_field_cb param Abstract some aspects of the getting/setting of box rest fields to make custom handling easier Add ability to short-circuit the register_rest_field with a callback. Allows registering callback with a different rest slug Oops, send the fallback value to the box_types method Add props for CMB2#1238 Fixes CMB2#1238 by merging with changes, and add CMB2::is_box_type method for checking. Fixes CMB2#1158 Add props for CMB2#1314 minify minify Re-add padding to textareas for readability Fix alpha color picker sample color styling clarify coment limit to 5.3 branch update block editor radio fix initial 5.3 prep work Add new "cmb2_display_class_{$fieldtype}" filter and field "display_class" parameter to allow specifying the class to use to display the field (in admin columns, etc) Fix another place where taxonomy_select_hierarchical was missed Add props for CMB2#1296 & CMB2#1297 Add props for CMB2#1300 Add props for CMB2#1307 Update npm dependencis. Fixes CMB2#1308 Remove grunt-contrib-compress and grunt-combine-media-queries to cut down on npm dependencies taxonomy_select_hierarchical is added in order to save correctly in to database Fix tests broke by introduction of character counter field property Fix issue introduced in 7cb3e00 where field was updated not not returned, breaking things If field has supporting data (e.g. file), add supporting data to field data (i.e supporting field id/value) Add changelog and props for CMB2#1300 Update .min file for CMB2#1300 Add comments to document changes in CMB2#1300 Include .CodeMirror class in sortable exclusions Run the field-specific actions for all fields (including fields in groups). Fixes CMB2#1157 Escaping Improvements to File Base Escaping improvements to File Fields Add changelog and props for CMB2#1276 Refactor character-counter integration ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Versions
Expected Behavior:
When registering metaboxes for two different custom post types to be visible in the REST API (using
/wp/v2/{post_type}
) the 'cmb2' object in REST response will only contain the metaboxes for that post type.Actual Behavior:
The REST response for both post types contains all metaboxes, albeit the fields in the boxes not registered to that post type all have empty values
Steps to reproduce (I have confirmed I can reproduce this issue on the trunk branch):
show_in_rest => true
show_in_rest => true
cmb2_init
hook instead ofcmb2_admin_init
cmb2
key, the correct one will be populated with values, the other will notCMB2 Field Registration Code:
The text was updated successfully, but these errors were encountered: