#33023 closed defect (bug) (fixed)
_get_custom_object_labels should not change data type to Array from Object.
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 4.2.2 |
Component: | Posts, Post Types | Keywords: | has-patch |
Focuses: | Cc: |
Description
When you use construction like this:
$post_type_obj = get_post_type_object ( $post_type );
$labels = get_post_type_labels($post_type_obj)
.............................
global $wp_post_types will be rewrite and property $wp_post_types[$post_type]->labels will be an array and must be object.
It is critical for wp-admin/includes/post.php $sendback_text = get_post_type_object( $post->post_type )->labels->all_items; (~line 1250)
wp-includes/post.php line:1716 - 1718
$defaults[$key] = $object->hierarchical ? $value[1] : $value[0]; } $labels = array_merge( $defaults, $object->labels ); + $object->labels = (object)$object->labels; return (object) $labels; }
Attachments (1)
Change History (7)
#2
@
9 years ago
- Component changed from General to Posts, Post Types
There is Same Problem in get_taxonomy_labels.
$wp_taxonomies[ $taxonomy ]->labels is converted array from object.
#3
@
9 years ago
If use get_post_type_labels ,
Notice Error occured in wp_admin_bar_new_content_menu and wp_admin_bar_edit_menu.
Should fix the wp_admin_bar_new_content_menu and wp_admin_bar_edit_menu?
#4
@
9 years ago
- Summary changed from Error wp-includes/post.php in _get_custom_object_labels to _get_custom_object_labels should not change data type to Array from Object.
_get_custom_object_labels should not change data type to array from object.
Add Test Case.