[wp-trac] [WordPress Trac] #56691: Introduce a function get excerpt length

WordPress Trac noreply at wordpress.org
Thu Sep 29 15:45:11 UTC 2022


#56691: Introduce a function get excerpt length
-------------------------+-----------------------------
 Reporter:  tremidkhar   |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 Currently, there is no way we can get the excerpt length whether the
 default or the filtered value.

 This will be useful when developers in some way need to get the post
 excerpt length.

 For now, developers can use something like the following to match the
 excerpt length with the of the site.

 {{{#!php
 <?php
 $excerpt_length = apply_filters( 'excerpt_length', 40 );
 }}}

 With the new function, developers don't have to remember to add the
 filter, they can just call the function and get the excerpt length that
 matches the rest of the site.

 {{{#!php
 <?php
 $excerpt_length = get_excerpt_length();
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56691>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list