Make WordPress Core

Changeset 44224 for trunk


Ignore:
Timestamp:
12/16/2018 01:58:41 AM (7 years ago)
Author:
jeremyfelt
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.

Merges [43858] from the 5.0 branch to trunk.

Props dd32.
See #45236.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-admin/includes/post.php

    r44222 r44224  
    684684     * @param WP_Post $post         Post object.
    685685     */
    686     $post->post_content = apply_filters( 'default_content', $post_content, $post );
     686    $post->post_content = (string) apply_filters( 'default_content', $post_content, $post );
    687687
    688688    /**
     
    694694     * @param WP_Post $post       Post object.
    695695     */
    696     $post->post_title = apply_filters( 'default_title', $post_title, $post );
     696    $post->post_title = (string) apply_filters( 'default_title', $post_title, $post );
    697697
    698698    /**
     
    704704     * @param WP_Post $post         Post object.
    705705     */
    706     $post->post_excerpt = apply_filters( 'default_excerpt', $post_excerpt, $post );
     706    $post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post );
    707707
    708708    return $post;
Note: See TracChangeset for help on using the changeset viewer.