[wp-trac] [WordPress Trac] #10724: Cannot change excerpt_length using codex example

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 3 14:20:19 UTC 2009


#10724: Cannot change excerpt_length using codex example
--------------------------+-------------------------------------------------
 Reporter:  jsherk        |       Owner:                                
     Type:  defect (bug)  |      Status:  new                           
 Priority:  normal        |   Milestone:  2.8.5                         
Component:  General       |     Version:  2.8.4                         
 Severity:  normal        |    Keywords:  excerpt_length, excerpt length
--------------------------+-------------------------------------------------
 Putting this code below (per codex) in the themes functions.php file does
 not make any difference to excerpt length (stays at 55 no matter what):
 function new_excerpt_length($length) {
   return 20;
 }
 add_filter('excerpt_length', 'new_excerpt_length');

 Looking at the changes made in formatting.php, this line:
 $excerpt_length = apply_filters('excerpt_length', 55);
 appears that it will ALWAYS return 55 no matter what you set your
 add_filter too... this line is essentially the same as:
 $excerpt_length = 55;
 so you cannot modify it even with an add_filter call.

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


More information about the wp-trac mailing list