[wp-trac] [WordPress Trac] #24292: Use wp_trim_words() in Recent Drafts widget

WordPress Trac noreply at wordpress.org
Wed May 8 23:04:38 UTC 2013


#24292: Use wp_trim_words() in Recent Drafts widget
----------------------------+-----------------------
 Reporter:  SergeyBiryukov  |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  3.6
Component:  Administration  |    Version:  2.7
 Severity:  normal          |   Keywords:  has-patch
----------------------------+-----------------------
 This construct is used in Recent Drafts dashboard widget to display first
 10 words of a post:
 {{{
 if ( $the_content = preg_split( '#[\r\n\t ]#', strip_tags(
 $draft->post_content ), 11, PREG_SPLIT_NO_EMPTY ) )
         $item .= '<p>' . join( ' ', array_slice( $the_content, 0, 10 ) ) .
 ( 10 < count( $the_content ) ? '…' : '' ) . '</p>';
 }}}
 Introduced in [9536]. We should just use `wp_trim_words()` instead.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24292>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list