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
- Sending the reset password link programatically
- Getting only direct child pages in WordPress with get_pages
- Any guides on creating custom admin pages?
- Multiple is_page() in page.php
- Create WordPress pages with PHP
- How to return the_excerpt (without echo)?
- Is it possible to generate a page without create in the admin?
- WordPress admin never finishes saving page on site with large page count
- 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
- Trim first 2 words of the exceprt
- Help with a custom page template – listing contents of childpages?
- Extremely slow pageload for long post when using the_content?
- Passing the page ID to a login php script
- 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 ?
- Add a Different CSS Class Into The Body Tag of Different WP Pages
- Excerpt unwanted text “”
- Word Count Function Preventing Permalink Editing
- syntax issue on php 7.4
- Custom Template 404 for specific custom post type
- Can’t load WP function into external function
- How to Display a Single Post Excerpt
- How to remove the excerpt in the Dzonia Lite theme
- Way to querry data (tags) from a wordpress database?
- Global variable $post returning incorrect object
- How do I Add HTML to the_excerpt() & the_content() Output?
- How to add a php custom page to WordPress
- Mass update excerpt
- How can I add an area/option for a custom page description?
- Create Page To Count Comments For Each Post In WordPress Site
- Query Pages and post excerpts dynamically
- get_the_title() gets printed out twice
- How do I find PHP file that contains content of my page?
- 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
- 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 show an entire post content and not also the excerpt?
- stripping tags from excerpt in WordPress is not working
- 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
- 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
- Display child page content of a specific parent on home page
- 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?
- Unique PHP on each Page
- How to Display a List of Child Pages For a Parent Page in WordPress
- WordPress Search
- List all anchor links on a page
- Assign Custom classes to every Excerpt
- 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
- Display page content in different sections – based on page break block?
- Trying to modify content.php
- Child and Parent Pages list of sub pages
- loading a php file to a specific page id
- Getting page / post URL on publish and / or update
- Get current_post in reverse order with pagination
- How to trim content AND retain HTML?
- How to apply filter
- Create a custom theme-specific page, invisible in the admin-panel?
- Archive page if else not working for post_excerpt and post_content
- Replace content in WordPress Page after GET from php page
- Execute php in pages
- How to use PHP code with wordpress page
- Creating a function that sanitizes the custom metabox excerpt
- Trying to put a search page on site
- I want Page titles and excerpts to show up on home.php in certain order
- ACF: Echo page title when checkbox is checked
- Create a custom page URL
- How to refresh a template page on WordPress in 3 seconds – easiest method?
- How to handle parent and child pages?
- How do I remove blog entries from home page Twenty Eleven child theme?
- Remove post image caption from post_excerpt();
- generate excerpt from the part of big text dump that contains keyword