Posts, Post Types: Check if the post type exists in `_admin_notice_post_locked()`.
This adds a guard to verify the result of `get_post_type_object()` before retrieving the `all_items` label, as the function returns `null` if the post type does not exist. Follow-up to [24527]. Props pcarvalho, akshat280, mukesh27, SergeyBiryukov. Fixes #60947. Built from https://develop.svn.wordpress.org/trunk@58983 git-svn-id: http://core.svn.wordpress.org/trunk@58379 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
02d2fa959a
commit
d65e65cd6c
|
@ -1805,17 +1805,20 @@ function _admin_notice_post_locked() {
|
|||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if ( $locked && $sendback && ! str_contains( $sendback, 'post.php' ) && ! str_contains( $sendback, 'post-new.php' ) ) {
|
||||
|
||||
$sendback_text = __( 'Go back' );
|
||||
} else {
|
||||
|
||||
if ( ! $locked || ! $sendback || str_contains( $sendback, 'post.php' ) || str_contains( $sendback, 'post-new.php' ) ) {
|
||||
$sendback = admin_url( 'edit.php' );
|
||||
|
||||
if ( 'post' !== $post->post_type ) {
|
||||
$sendback = add_query_arg( 'post_type', $post->post_type, $sendback );
|
||||
}
|
||||
|
||||
$sendback_text = get_post_type_object( $post->post_type )->labels->all_items;
|
||||
$post_type_object = get_post_type_object( $post->post_type );
|
||||
|
||||
if ( $post_type_object ) {
|
||||
$sendback_text = $post_type_object->labels->all_items;
|
||||
}
|
||||
}
|
||||
|
||||
$hidden = $locked ? '' : ' hidden';
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-alpha-58981';
|
||||
$wp_version = '6.7-alpha-58983';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue