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

Sanitize post types when adding meta boxes #692

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

enrico-sorcinelli
Copy link
Contributor

Recenlty, I added a meta box with a code like that:

$fm->add_meta_box( 'test meta box', '   post' );

by adding accidentally a blank space in the post type.
I notice that the box is still added, since behind the scenes, the type value is sanified.
However this is not be done when saving/updating post, so the custom fields are not updated.
I spent some time to understand why :-) so the patch try to solve that by sanitizing post_types values on constructors.

I had to check post_types type values since, even if the doc says that must be strings, many tests use
$field->add_meta_box( 'test meta box', $this->post ); and I think they should be fixed (it will simplify also this PR).
Note that command above doesn't fail and doesn't do anyting due to this.

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

Successfully merging this pull request may close these issues.

1 participant