WordPress.org

Make WordPress Core

Changeset 43858


Ignore:
Timestamp:
11/01/2018 05:19:48 AM (13 months ago)
Author:
pento
Message:

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.

Props dd32.
See #45236.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-admin/includes/post.php

    r43856 r43858  
    640640     * @param WP_Post $post         Post object.
    641641     */
    642     $post->post_content = apply_filters( 'default_content', $post_content, $post );
     642    $post->post_content = (string) apply_filters( 'default_content', $post_content, $post );
    643643
    644644    /**
     
    650650     * @param WP_Post $post       Post object.
    651651     */
    652     $post->post_title = apply_filters( 'default_title', $post_title, $post );
     652    $post->post_title = (string) apply_filters( 'default_title', $post_title, $post );
    653653
    654654    /**
     
    660660     * @param WP_Post $post         Post object.
    661661     */
    662     $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
     662    $post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post );
    663663
    664664    return $post;
Note: See TracChangeset for help on using the changeset viewer.