[{"data":1,"prerenderedAt":11},["ShallowReactive",2],{"$f35wb1kyks7csr":3},{"slug":4,"title":5,"description":6,"published":7,"updated":8,"thumb":9,"html":10},"how-to-change-default-wordpress-excerpt-length","How To Change Default WordPress Excerpt Length","If you want to change the default excerpt length of a WordPress site, you can do it using the code below. Paste it in the funtions.php file and update the...","2015-03-23","2016-06-17",null,"\u003Cp>If you want to change the default excerpt length of a WordPress site, you can do it using the code below. Paste it in the funtions.php file and update the number in line 9.\u003C\u002Fp>\n\u003Cp>\u003Ccode>\u003Cbr \u002F>\nremove_filter('get_the_excerpt', 'wp_trim_excerpt');\u003Cbr \u002F>\nfunction custom_trim_excerpt($text) {\u003Cbr \u002F>\nglobal $post;\u003Cbr \u002F>\nif ( '' == $text ) {\u003Cbr \u002F>\n$text = get_the_content('');\u003Cbr \u002F>\n$text = apply_filters('the_content', $text);\u003Cbr \u002F>\n$text = str_replace(']]>', ']]>', $text);\u003Cbr \u002F>\n$text = strip_tags($text);\u003Cbr \u002F>\n$excerpt_length = 75;\u003Cbr \u002F>\n$words = explode(' ', $text, $excerpt_length + 1);\u003Cbr \u002F>\nif (count($words) > $excerpt_length) {\u003Cbr \u002F>\narray_pop($words);\u003Cbr \u002F>\narray_push($words, '[...]');\u003Cbr \u002F>\n$text = implode(' ', $words);\u003Cbr \u002F>\n}\u003Cbr \u002F>\n}\u003Cbr \u002F>\nreturn $text;\u003Cbr \u002F>\n}\u003Cbr \u002F>\nadd_filter('get_the_excerpt', 'custom_trim_excerpt');\u003Cbr \u002F>\n\u003C\u002Fcode>\u003C\u002Fp>",1793901039331]