WordPress.org

Make WordPress Core

Ticket #36934: 36934.3.patch

File 36934.3.patch, 2.5 KB (added by achbed, 4 years ago)

Updated patch to push $post parameter through get_the_content

  • src/wp-includes/default-filters.php

     
    141141add_filter( 'the_excerpt',     'convert_chars'    );
    142142add_filter( 'the_excerpt',     'wpautop'          );
    143143add_filter( 'the_excerpt',     'shortcode_unautop');
    144 add_filter( 'get_the_excerpt', 'wp_trim_excerpt'  );
     144add_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10, 2 );
    145145
    146146add_filter( 'comment_text', 'wptexturize'            );
    147147add_filter( 'comment_text', 'convert_chars'          );
  • src/wp-includes/formatting.php

     
    28812881 * The ' […]' string can be modified by plugins/themes using the {@see 'excerpt_more'} filter
    28822882 *
    28832883 * @since 1.5.0
     2884 * @since 4.6.0 Introduced the `$post` parameter.
    28842885 *
    28852886 * @param string $text Optional. The excerpt. If set to empty, an excerpt is generated.
    28862887 * @return string The excerpt.
    28872888 */
    2888 function wp_trim_excerpt( $text = '' ) {
     2889function wp_trim_excerpt( $text = '', $post = null ) {
    28892890        $raw_excerpt = $text;
    28902891        if ( '' == $text ) {
    2891                 $text = get_the_content('');
     2892                $text = get_the_content( '', false, $post );
    28922893
    28932894                $text = strip_shortcodes( $text );
    28942895
  • src/wp-includes/post-template.php

     
    246246 * Retrieve the post content.
    247247 *
    248248 * @since 0.71
     249 * @since 4.6.0 Introduced the `$post` parameter.
    249250 *
    250251 * @global int   $page
    251252 * @global int   $more
     
    255256 *
    256257 * @param string $more_link_text Optional. Content for when there is more text.
    257258 * @param bool   $strip_teaser   Optional. Strip teaser content before the more text. Default is false.
     259 * @param int|WP_Post|null  $post           Optional. Post ID or post object. Defaults to global $post.
    258260 * @return string
    259261 */
    260 function get_the_content( $more_link_text = null, $strip_teaser = false ) {
     262function get_the_content( $more_link_text = null, $strip_teaser = false, $post = false ) {
    261263        global $page, $more, $preview, $pages, $multipage;
    262264
    263         $post = get_post();
     265        $post = get_post( $post );
    264266
    265267        if ( null === $more_link_text )
    266268                $more_link_text = __( '(more…)' );