Opened 5 years ago
Last modified 5 years ago
#49109 new defect (bug)
Array offset access notice problem with `remove_meta_box()` and `add_meta_box()` function.
Reported by: | kmvan | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | critical | Version: | 5.3.2 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
When I use remove_meta_box()
function:
<?php \remove_meta_box('postcustom', 'post', 'normal');
The function will set postcustom
to false, code in /wp-admin/includes/template.php line 1405:
<?php $wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = false;
Shall use unset
, likes:
<?php unset($wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ]);
So, code in /wp-admin/includes/template.php line 1049~1051:
<?php if ( ! isset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) { continue; }
The false
value will be not enter the condition. Likes:
<?php $a = false; var_dump(isset($a)); // true
So. array offset access notice shows: /wp-admin/includes/template.php on line 1078
Happening on create/edit post page.
Note: See
TracTickets for help on using
tickets.
bump and experiencing this me too.
even if the function is called presumabily correctly at do_meta_boxes action.