If you want to control the string count, then you can do it by the following.
Put the below code in the active theme’s functions.php file:–
function custom_excerpt_length( $length ) {
return 20; // You can change the number here as per your need.
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
By default, excerpt length is set to 55 words. To change excerpt
length to 20 words using excerpt_length filter, add the above code
to functions.php file in your theme:
For more details check the Codex
Related Posts:
- How to end the excerpt with a sentence rather than a word?
- Modify ‘Read more’ link adding a new class
- Text after more tag in posts
- How to create a load more post entries like Twitter?
- “more” tag doesn’t appear when browsing category achives or search
- WP Bakery Load More Button loads the same posts
- Add Read More Tag to a post content (Single.php)
- Remove Content after
- “read more” redirects to the wrong page
- get “read more” with custom DB query like you would with WP Query
- Remove read more
- Read more opens attachment
- How to automatically generate a unique random slug
- How does filter the_posts work?
- SQL Query for getting all posts in their latest revised state
- Publish pending article from front end with a button?
- How can I export WordPress posts’ attachments?
- Restrict the Number of Posts an Author can Publish (over time)?
- How do I convert a mathematical Microsoft Word document to a WordPress blog post?
- Which file displays the date archive?
- Add custom field to category of custom post type
- Change post format using custom field
- Plugin for sortable posts in grid [closed]
- How can I make existing custom fields easier to edit/add in my theme?
- Code Blocks with WYSIWYG in blog post
- What Can I Use To Add A Custom Button Between Publish button and Move To Trash?
- generate unique slug while inserting post
- How to intercept Post Title on Post-Save
- Display Latest Post from all Categories
- WordPress theme ajax have_posts()
- How to show post(excerpt) from specific category on wp page?
- Easy way to delete 70k posts and attached media?
- wp_insert_post works, but the post isn’t visible in the admin post list or front end
- Remove arrows from previous and next link
- Get all images out of the posts content
- How to Use PHP Code In-Page?
- XML-RPC and post_date
- wp_tag_cloud() and the_taxonomies() work but not the_tag()
- Split WordPress Latest Posts in Multiple Columns and Rows with one single loop [closed]
- Remove certain post-formats from showing in blog?
- How to display data in archive page?
- wp_insert_post – duration
- Print a message if excerpt is empty after posts have been publish/update!
- Display posts styled exactly like default posts
- Recent Post Added To Menu Shows Ghost Post With No Title
- How to display the link (title) and thumbnail post?
- Insert Content In Between Post Feed
- How to bulk-untag multiple posts?
- Using $wpdb to fetch posts with meta data
- How do I stop the loop from repeating in my category template?
- Get post ID in post/page edit area
- Is there a way to specify an extra class for a post or page with no title?
- Second get_permalink inside loop points to wrong URL
- Restrict the_post-navigation to same category?
- What does WordPress do if I save a post without content/title? [duplicate]
- Use Click Image to Play Youtube Video in a WordPress Loop
- How to get all post_parents of a post?
- Prevent posts with certain post_meta to be edited
- How to get different Related Posts
- How to convert query sql to shortcode in wordpress?
- Stop post submission without losing data?
- how to get day month and year from wp_post_object?
- Using Posts Like a Page
- Pagination for normal (standard) posts on a page with a custom loop?
- How can I add a page that shows posts from a single category?
- Pasting formatted text from MS-Word
- How to Rearrange WordPress Tags list on frontend using Shortcode with specific order?
- Custom post grid
- Need help creating a page that has editable fields
- How to hide protected posts from archive?
- Featured image error after importing blog posts
- Count words for each author separately
- Current post categories and subcatecories outside of the loop
- How do I remove all links from all my posts at once?
- Settings missing from the add new post page
- Display Updated Date Instead of Published Date
- Replace Tag Keyword With Link Within Post Content
- WordPress Delete Users from backend doesn’t work
- New blog post published notification – Buddypress
- Custom post styling per category?
- What is the difference between options and custom fields (meta) in WordPress?
- Shortcode: How to add custom posts?
- Meta boxes not saving
- problem with creating a wordpress post slider
- Post Publish Metaxbox on a Front End Page
- Hide first blog post in content and output it in widget
- Allow users to create their own page/s
- custom single.php post showing up twice
- How to use extract shortcode in loop?
- SQL query to remove first image in all posts
- Create custom URL with different levels
- Make division in post_query?
- making a few sites in wordpress
- How to use wp_editor(); in functions.php then retrieve content in the template
- Simple method to generate posts from files
- WordPress posts loop pagination – first page return 125 posts instead of 10 and the rest return 10
- clicking on page title
- change page name on page list
- append $_GET parameters to post
- Dynamic Menu Item