{"id":6668,"date":"2018-07-08T08:02:22","date_gmt":"2018-07-08T12:02:22","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=6668"},"modified":"2021-12-08T11:35:26","modified_gmt":"2021-12-08T16:35:26","slug":"change-default-excerpt-length-wordpress","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/","title":{"rendered":"So you Want to Change The Default Excerpt Length In WordPress"},"content":{"rendered":"\n

Now that you are deep into customizing your WordPress<\/a> themes, there begs the question of how to customize the default excerpt length.<\/p>\n\n\n\n

The thing is, WordPress comes with a default excerpt length of 55 words. Depending on what you want your theme to look like you may want to increase this word count or more often than not reduce it entirely.<\/p>\n\n\n\n

The challenge here comes in how to get it done. Many will probably tell you to just search for, download, and install a plugin, and hey presto, it’s done.<\/p>\n\n\n\n

That may work to some extent but it poses some other problems. These include risking security in case the plugin is compromised.\u00a0The plugin developer may also change some terms in the future which may no longer favor you. The plugin developer may also decide to push ads through the plugin.<\/p>\n\n\n\n

The Easier way to Change the WordPress Default Excerpt Length<\/h2>\n\n\n\n

With just four lines of code, you can do the same thing that obtrusive plugins do. What’s better, is you do not need to worry about the next update ruining your site layout, and that’s peace of mind.<\/p>\n\n\n\n

What you need to do is open your functions.php file found in your theme’s folder. At this\u00a0point, we will assume that you have some rudimentary knowledge of the PHP<\/a> programming language. If you don’t there are plenty of good PHP tutorials you can look at online. If you are modifying a theme written by someone else you may need to use a child theme of that parent theme instead.<\/p>\n\n\n\n

Add the following code at the bottom of the file and save. In the code where it says: return 20;<\/code> change that number to anything your desire.<\/p>\n\n\n\n

\/* Custom Excerpt length *\/\nfunction my_excerpt_length( $length ) {\n    return 20;\n    }\nadd_filter( 'excerpt_length', 'my_excerpt_length', 999 );<\/code><\/pre>\n\n\n\n

There you have it. You now have complete control over WordPress’ default excerpt length. Now you do not have to worry about third-party plugins slowing down or compromising your website.<\/p>\n\n\n\n

Ref:<\/p>\n\n\n\n

Official PHP functions documentation<\/a><\/p>\n\n\n\n

WordPress developer reference<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

Now that you are deep into customizing your WordPress themes, there begs the question of how to customize the default excerpt length. The thing is, WordPress comes with a default…<\/p>\n","protected":false},"author":1,"featured_media":6669,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,27,16,17],"tags":[136,320,452,460,543,544,581,635,636,651],"yoast_head":"\nHere's how to Change The Default Excerpt Length In WordPress<\/title>\n<meta name=\"description\" content=\"This simple tip shows how to change the default excerpt length in Wordpress to perfectly match your theme without using a plugin\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Here's how to Change The Default Excerpt Length In WordPress\" \/>\n<meta property=\"og:description\" content=\"This simple tip shows how to change the default excerpt length in Wordpress to perfectly match your theme without using a plugin\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-08T12:02:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-08T16:35:26+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"So you Want to Change The Default Excerpt Length In WordPress\",\"datePublished\":\"2018-07-08T12:02:22+00:00\",\"dateModified\":\"2021-12-08T16:35:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/\"},\"wordCount\":339,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg\",\"keywords\":[\"CMS\",\"Internet\",\"PHP\",\"Plugins\",\"Software Design\",\"Software development\",\"Themes\",\"Web\",\"Web Applications\",\"WordPress\"],\"articleSection\":[\"Articles\",\"Guides\",\"Programming\",\"Technology\",\"Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/\",\"url\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/\",\"name\":\"Here's how to Change The Default Excerpt Length In WordPress\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg\",\"datePublished\":\"2018-07-08T12:02:22+00:00\",\"dateModified\":\"2021-12-08T16:35:26+00:00\",\"description\":\"This simple tip shows how to change the default excerpt length in Wordpress to perfectly match your theme without using a plugin\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg\",\"width\":1200,\"height\":630,\"caption\":\"default excerpt length\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So you Want to Change The Default Excerpt Length In WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/twitter.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Here's how to Change The Default Excerpt Length In WordPress","description":"This simple tip shows how to change the default excerpt length in Wordpress to perfectly match your theme without using a plugin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"Here's how to Change The Default Excerpt Length In WordPress","og_description":"This simple tip shows how to change the default excerpt length in Wordpress to perfectly match your theme without using a plugin","og_url":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2018-07-08T12:02:22+00:00","article_modified_time":"2021-12-08T16:35:26+00:00","og_image":[{"width":1200,"height":630,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg","type":"image\/jpeg"}],"author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"So you Want to Change The Default Excerpt Length In WordPress","datePublished":"2018-07-08T12:02:22+00:00","dateModified":"2021-12-08T16:35:26+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/"},"wordCount":339,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg","keywords":["CMS","Internet","PHP","Plugins","Software Design","Software development","Themes","Web","Web Applications","WordPress"],"articleSection":["Articles","Guides","Programming","Technology","Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/","url":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/","name":"Here's how to Change The Default Excerpt Length In WordPress","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg","datePublished":"2018-07-08T12:02:22+00:00","dateModified":"2021-12-08T16:35:26+00:00","description":"This simple tip shows how to change the default excerpt length in Wordpress to perfectly match your theme without using a plugin","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2018\/07\/custom_excerpt.jpg","width":1200,"height":630,"caption":"default excerpt length"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/change-default-excerpt-length-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"So you Want to Change The Default Excerpt Length In WordPress"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/twitter.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/6668"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=6668"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/6668\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/6669"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=6668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=6668"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=6668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}