Make WordPress Core


Ignore:
Timestamp:
08/14/2019 05:17:51 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: In wp_trim_words() make sure the $num_words parameter is always an integer, as documented, to avoid a PHP warning.

Props donmhico, pikamander2.
Fixes #47867.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r45769 r45796  
    37293729                 * @param int $number The maximum number of words. Default 55.
    37303730                 */
    3731                 $excerpt_length = apply_filters( 'excerpt_length', $excerpt_length );
     3731                $excerpt_length = (int) apply_filters( 'excerpt_length', $excerpt_length );
    37323732
    37333733                /**
    … …  
    37743774        $original_text = $text;
    37753775        $text          = wp_strip_all_tags( $text );
     3776        $num_words     = (int) $num_words;
    37763777
    37773778        /*
Note: See TracChangeset for help on using the changeset viewer.