In `get_post_type_labels()`, ensure that filtered labels contain all required default values.

fixes #33543.
Built from https://develop.svn.wordpress.org/trunk@33776


git-svn-id: http://core.svn.wordpress.org/trunk@33744 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-08-28 03:39:21 +00:00
parent 78d43de7e4
commit 4e77ffdee1
2 changed files with 9 additions and 2 deletions

View File

@ -1337,6 +1337,8 @@ function get_post_type_labels( $post_type_object ) {
$post_type = $post_type_object->name;
$default_labels = clone $labels;
/**
* Filter the labels of a specific post type.
*
@ -1349,7 +1351,12 @@ function get_post_type_labels( $post_type_object ) {
*
* @param object $labels Object with labels for the post type as member variables.
*/
return apply_filters( "post_type_labels_{$post_type}", $labels );
$labels = apply_filters( "post_type_labels_{$post_type}", $labels );
// Ensure that the filtered labels contain all required default values.
$labels = (object) array_merge( (array) $default_labels, (array) $labels );
return $labels;
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-33775';
$wp_version = '4.4-alpha-33776';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.