Editor: Cast the result of the default_content
, default_title
, and default_excerpt
filters.
If a plugin returns a non-string value (or returns `null`) on these filters, it can cause errors in the block editor. Casting them as a string prevents these errors. Merges [43858] from the 5.0 branch to trunk. Props dd32. See #45236. git-svn-id: https://develop.svn.wordpress.org/trunk@44224 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3261d687bb
commit
7f2a7a3f3e
@ -683,7 +683,7 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
||||
* @param string $post_content Default post content.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
$post->post_content = apply_filters( 'default_content', $post_content, $post );
|
||||
$post->post_content = (string) apply_filters( 'default_content', $post_content, $post );
|
||||
|
||||
/**
|
||||
* Filters the default post title initially used in the "Write Post" form.
|
||||
@ -693,7 +693,7 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
||||
* @param string $post_title Default post title.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
$post->post_title = apply_filters( 'default_title', $post_title, $post );
|
||||
$post->post_title = (string) apply_filters( 'default_title', $post_title, $post );
|
||||
|
||||
/**
|
||||
* Filters the default post excerpt initially used in the "Write Post" form.
|
||||
@ -703,7 +703,7 @@ function get_default_post_to_edit( $post_type = 'post', $create_in_db = false )
|
||||
* @param string $post_excerpt Default post excerpt.
|
||||
* @param WP_Post $post Post object.
|
||||
*/
|
||||
$post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
|
||||
$post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post );
|
||||
|
||||
return $post;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user