You can use this function wp_trim_words()
. It allows you to format the output, and strips all the HTML tags in the content (it uses wp_strip_all_tags
).
You will have to pass post_content
as the first paramenter.
Related Posts:
- Using the_excerpt() on a page
- Allow HTML in excerpt
- Sending the reset password link programatically
- Getting only direct child pages in WordPress with get_pages
- Disable Attachment Pages Completely
- How to add a .php file to WordPress
- How to Remove all Instances of edit_post_link
- Any guides on creating custom admin pages?
- Multiple is_page() in page.php
- How to check if feed URL was requested?
- Create WordPress pages with PHP
- How to return the_excerpt (without echo)?
- How to get post or page excerpt using post_excerpt
- Is it possible to generate a page without create in the admin?
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- WordPress admin never finishes saving page on site with large page count
- class=”parent” for wp_list_pages?
- Limit the Excerpt field in WP-Admin in words
- PHP Script within wordpress theme
- Limit the_excerpt with max of x characters
- Remove at the beginning of the_excerpt() with str_replace
- add_rewrite_rule with bottom priority doesn’t handle the WordPress pages
- Listing all sub-pages?
- Automatic Excerpt Not Working
- How to link to a custom .php page in my folder
- Trim first 2 words of the exceprt
- Get only the grandchildren, not the direct children of page/current page?
- Help with a custom page template – listing contents of childpages?
- Extremely slow pageload for long post when using the_content?
- Print number of post (in reverse)
- Passing the page ID to a login php script
- How to change / delete product short description in Woocommerce
- Why does running get_the_excerpt() when generating JSON file take 28 seconds vs. 599 milliseconds without it?
- How can the plugin directory path be returned into ?
- get_the_title() gets printed out twice
- How do I find PHP file that contains content of my page?
- My custom get_the_excerpt() can’t get excerpt by ID
- WordPress page content outside WordPress
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Inject class in body when particular page template is used
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- How to check if the current page is at a specified path in the URL?
- Show About and Contact Us page when they’re clicked in the top menu.
- Parsing Menu Items and Blog Posts
- How to use theme function in post/page?
- How to show an entire post content and not also the excerpt?
- My php code is not being executed
- stripping tags from excerpt in WordPress is not working
- trouble with page_id & highlighting current page
- Apply class to every third list item? [duplicate]
- How to include custom code on a page that’s set to act as homepage?
- Can a page contain php code?
- Almost Done… Post Format Code
- What’s the best way to include PHP code in pages?
- Automatically add images to a menu
- Automatic excerpt is not shown with the_excerpt() command
- page-slug.php not working but only for specific slug
- Need php code’s output to display underneath a Divi Module
- Insert page content into another page with a changed variable
- How to echo every parent page title?
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- Retrieve Json data and create multiple pages with it
- How to add page numbering with php?
- Display child page content of a specific parent on home page
- Noindex subscriber author page
- Remove   from the_excerpt
- Shortcodes showing in excerpt despite using strip_shortcodes
- How to remove the space before the ellipsis in excerpt?
- Need help removing […] after excerpt
- Removing custom sort order from admin page listing
- PHP Output also in Child theme, but different
- $wpdb->get_results breaking page?
- Post class only applying to first excerpt; why?
- Unique PHP on each Page
- How to Display a List of Child Pages For a Parent Page in WordPress
- If is page, archive or search output this code
- WordPress Search
- List all anchor links on a page
- Assign Custom classes to every Excerpt
- Toolbar Hidden in a Virtual Page
- How do I add my PHP app to a WordPress page whilst keeping semantic URLs?
- Page load timer?
- Problem in replacing the_content with the_excerpt()
- Page not visible in ‘All pages’ after being added through PHP
- Cascading dropdown select search based on Parent Page & Child Page
- Edit and delete permissions pages and posts
- My worpress search page is showing no results
- A function to get the content of a page
- How can I check if a post with a particular slug or title exists?
- When I click for the redirect link it is showing the content of index.php instead of single_assignment_page.php
- Category Page Displaying all Pages
- Find and print first entry from WordPress post in custom excerpt?
- Split post or page content in two or more columns
- Display page content in different sections – based on page break block?
- Cannot figure out how to add a read more link to a manual excerpt. Please help
- Trying to modify content.php
- Child and Parent Pages list of sub pages
- Static Page with php echo [duplicate]