{"id":59,"date":"2020-06-30T10:42:34","date_gmt":"2020-06-30T10:42:34","guid":{"rendered":"http:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/"},"modified":"2020-06-30T10:42:34","modified_gmt":"2020-06-30T10:42:34","slug":"how-to-increase-or-decrease-excerpt-length-in-wordpress","status":"publish","type":"post","link":"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/","title":{"rendered":"How to increase or decrease excerpt length in wordpress"},"content":{"rendered":"<p>With the help of wordpress function we can decrease and increase the defalut excerpt length. By default the excerpt length is set to 55. Also when using excerpt length wordpress placed the [\u2026.] string at the end of any paragraph. We will also see that how we can remove it to overcome neat and clean paragraph text only. Its very easy with few lines of codes.<br \/>\nIf you want to change the length no. simply change the value of return 20 to something you desire.<\/p>\n<h2>How to increase or decrease excerpt length in wordpress.<\/h2>\n<p>Paste the below into your function.php<\/p>\n<pre>function custom_excerpt_length( $length ) {\n\treturn 20;\n}\nadd_filter( 'excerpt_length', 'custom_excerpt_length', 999 );\n<\/pre>\n<p>In this way you can just adjust the excerpt length to your own requirement. But you can see that the last word of the excerpt is truncated. You will see [\u2026.] the string.<\/p>\n<h2>Remove [\u2026.] string from the end of paragraph.<\/h2>\n<p>You will see the [\u2026.] at the very end of the paragraph where you have use the excerpt length. WordPress keeps that by default. We can use wordpress function to remove the charater and add the new character we want.<br \/>\nNow below code will help you to remove the [\u2026.] string from the end of the paragraph.<br \/>\nRemove [\u2026.] string from the end of excerpt line and creates a blank space.<\/p>\n<pre>function new_excerpt_more( $more ) {\n\treturn '';\n}\nadd_filter('excerpt_more', 'new_excerpt_more');\n<\/pre>\n<p>Removes the [\u2026.] string from the end of paragraph and adds the \u201cmore..\u201d text with the permalinks set.<\/p>\n<pre>function new_excerpt_more( $more ) {\n        $permalink = get_permalink($post-&gt;ID);\n\treturn '&lt;a href=\"'.$permalink.'\"&gt;more..&lt;\/a&gt;';\n}\nadd_filter('excerpt_more', 'new_excerpt_more');\n<\/pre>\n<p>However, You can customize it to your own needs.<\/p>\n<h2>Custom excerpt length without truncated<\/h2>\n<pre>function get_excerpt($count){\n  $permalink = get_permalink($post-&gt;ID);\n  $excerpt = get_the_content();\n  $excerpt = strip_tags($excerpt);\n  $excerpt = substr($excerpt, 0, $count);\n  $excerpt = $excerpt.'... &lt;a href=\"'.$permalink.'\"&gt;more&lt;\/a&gt;';\n  return $excerpt;\n}\n<\/pre>\n<p>We have cover how to increase or decrease excerpt length in wordpress.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the help of wordpress function we can decrease and increase the defalut excerpt length. By default the excerpt length is set to 55. Also when using excerpt length wordpress placed the [\u2026.] string at the end of any paragraph. We will also see that how we can remove it to overcome neat and clean [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-tips-and-ticks"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to increase or decrease excerpt length in wordpress - Santosh Kumar Shah<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to increase or decrease excerpt length in wordpress - Santosh Kumar Shah\" \/>\n<meta property=\"og:description\" content=\"With the help of wordpress function we can decrease and increase the defalut excerpt length. By default the excerpt length is set to 55. Also when using excerpt length wordpress placed the [\u2026.] string at the end of any paragraph. We will also see that how we can remove it to overcome neat and clean [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"Santosh Kumar Shah\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-30T10:42:34+00:00\" \/>\n<meta name=\"author\" content=\"Santosh Kumar Shah\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Santosh Kumar Shah\" \/>\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\":\"WebPage\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/\",\"url\":\"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/\",\"name\":\"How to increase or decrease excerpt length in wordpress - Santosh Kumar Shah\",\"isPartOf\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\"},\"datePublished\":\"2020-06-30T10:42:34+00:00\",\"author\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\"},\"breadcrumb\":{\"@id\":\"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/santosh-shah.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to increase or decrease excerpt length in wordpress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#website\",\"url\":\"https:\/\/santosh-shah.com\/blog\/\",\"name\":\"Santosh Kumar Shah\",\"description\":\"JavaScript Developer\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f\",\"name\":\"Santosh Kumar Shah\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g\",\"caption\":\"Santosh Kumar Shah\"},\"description\":\"I am JavaScript developer.\",\"sameAs\":[\"https:\/\/santosh-shah.com\/blog\"],\"url\":\"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to increase or decrease excerpt length in wordpress - Santosh Kumar Shah","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":"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"How to increase or decrease excerpt length in wordpress - Santosh Kumar Shah","og_description":"With the help of wordpress function we can decrease and increase the defalut excerpt length. By default the excerpt length is set to 55. Also when using excerpt length wordpress placed the [\u2026.] string at the end of any paragraph. We will also see that how we can remove it to overcome neat and clean [&hellip;]","og_url":"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/","og_site_name":"Santosh Kumar Shah","article_published_time":"2020-06-30T10:42:34+00:00","author":"Santosh Kumar Shah","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Santosh Kumar Shah","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/","url":"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/","name":"How to increase or decrease excerpt length in wordpress - Santosh Kumar Shah","isPartOf":{"@id":"https:\/\/santosh-shah.com\/blog\/#website"},"datePublished":"2020-06-30T10:42:34+00:00","author":{"@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f"},"breadcrumb":{"@id":"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/santosh-shah.com\/blog\/how-to-increase-or-decrease-excerpt-length-in-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/santosh-shah.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to increase or decrease excerpt length in wordpress"}]},{"@type":"WebSite","@id":"https:\/\/santosh-shah.com\/blog\/#website","url":"https:\/\/santosh-shah.com\/blog\/","name":"Santosh Kumar Shah","description":"JavaScript Developer","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/santosh-shah.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/b17cb45bdd5f518e74a08ad2c6c4b39f","name":"Santosh Kumar Shah","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/santosh-shah.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf46c57219d897547f3204b6b302169b3302b17507ccc902946b622a78d0b98b?s=96&d=mm&r=g","caption":"Santosh Kumar Shah"},"description":"I am JavaScript developer.","sameAs":["https:\/\/santosh-shah.com\/blog"],"url":"https:\/\/santosh-shah.com\/blog\/author\/sks7yu\/"}]}},"_links":{"self":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":0,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"wp:attachment":[{"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/santosh-shah.com\/blog\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}