Skip to content

Sanitize post types when adding meta boxes#692

Open
enrico-sorcinelli wants to merge 1 commit into
alleyinteractive:mainfrom
enrico-sorcinelli:sanitize-post-type
Open

Sanitize post types when adding meta boxes#692
enrico-sorcinelli wants to merge 1 commit into
alleyinteractive:mainfrom
enrico-sorcinelli:sanitize-post-type

Conversation

@enrico-sorcinelli
Copy link
Copy Markdown
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