At first glance, this appears to be an XY Problem.
If you simply want to increase the length of the excerpt auto-generated from the post content, you can use the excerpt_length hook in functions.php.
function modify_excerpt_length( $length ) {
return 300;
}
add_filter( 'excerpt_length', 'modify_excerpt_length', 99 );
Then simply call the excerpt in your template:
the_excerpt()
This will automatically remove all tags.
Related Posts:
- The_excerpt() doesn’t parse – how to change that?
- content summary of a post disappears If an images added at the beginning of the post. how to solve it?
- Related post not showing table of content
- Nothing appears using get_the_excerpt() in category.php
- How can i show only 30% of the “the_content(“More…”)”?
- Stop WordPress Wrapping Images In A “P” Tag
- GET the excerpt by ID
- Stop WordPress automatically adding tags to post content
- How to end the excerpt with a sentence rather than a word?
- Get content from one page and show it on another page
- Strategy for handling hierarchical pages with empty parent content
- Modify ‘Read more’ link adding a new class
- How to remove Nextpage tag inside posts text depending of utm_campaign
- Remove image caption from post excerpt
- How can you make sure authors’ posts are longer than 250 words?
- What is the best / efficient way to get WordPress content by post id and why?
- JSON not valid after json_encode posts
- Add default content to post (for specific category)
- Programmatically inserting page breaks
- Hide parts of the post content on the home page
- Load post content into div with ajax
- Custom wp_trim_words() function not trimming right
- How to show post(excerpt) from specific category on wp page?
- How to link up “read more” on excerpts hack from WP Recipies
- Append Text to $post->post_excerpt
- Frontend Post Excerpt field mapping
- Allowing the SoundCloud player to appear in a post excerpt
- Auto Refresh Post List after X seconds
- How to show video from specific category on sidebar?
- Same content shared between multiple posts?
- How to show a full post, not just an excerpt
- how load content as pop-up using ajax
- Get post excerpt and title by specific post ID?
- Custom excerpt length filter doesn’t work
- How to get only text from wordpress post content?
- Batch process: remove first image from post content
- Why content_arr[‘extended’] removes paragraph tags?
- Unautop / Sanitize content added to a post through a plugin
- is there a way to show the the post title after the image?
- How to get rid of shortcodes in post content once and for all
- Print a message if excerpt is empty after posts have been publish/update!
- Add Word Limit to Posts
- get_the_excerpt() is not working as expected – returns wrong text
- How do I display some posts fully on the homepage, and some as an excerpt only?
- Show only one page link in content pagination
- Show only posts with images and a fixed amount of posts
- How to display excerpt post on hamepage and archive pages?
- How to create new post content templates for my users?
- How to get a post’s content? [closed]
- Why does a published post only displays the title and not the content in the site? [closed]
- Displaying post excerpt using wpdb query
- Best Way to Add UnEditable HTML to Posts
- Trying to edit archive.php to only show post extract, with featured image
- Page and post loop same template
- Show metabox value last post excerpt, title and link
- Hook for changing excerpt content when excerpt not set
- Change the number of excerpts displayed in search results layout
- the_content() Not Grabbing All Content
- Why excerpt is Displaying same in Random Posts list
- Can’t save WordPress post with “/etc/” in it
- Hide parts of the post content after typing it’s name or searching it by category
- How to exclude the word “class” from being matched in search?
- Preview page/post revisions without overwriting current content
- WordPress Excerpt Paragraph Limiting
- Grab value of excerpt_length
- Calling Permalinks With PHP
- definining own teaser text for post
- Add text and change style to post programmatically depending on category
- why my urdu text is not aligned properly when written in wordpress blog post?
- How to add text before post_excerpt in Gutenberg
- Why is WordPress showing a blank excerpt for just one of my posts?
- How to limit wordpress the_excerpt() dynamically
- How to get unmodified post content?
- I have inserted a post’s content in homepage.php by the post-id. The font isn’t matching with the theme. How do I change font of this content?
- Enable HTML Tags in WordPress Post excerpt
- How to display post excerpt beside post list inside Post of Dashboard
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- Trim excerpt to first paragraph
- Add caption to thumbnails in content
- Adding div to WordPress page content
- Post List Widget with custom posts and editing the Read More Link
- Adding editable content above posts
- How to get post_content while the post is being edited
- Custom template for different post types
- Correcting the content width when sidebar is inactive?
- Multiple approval from editors before publishing?
- Add a minimum word count to Excerpt (and how to force Excerpt as a rule for WyPiekacz)
- Get part of a page url
- How to use wp_editor(); in functions.php then retrieve content in the template
- Add default content to post (for specific category)
- jquery: getting contents of #content field on post page
- Using the_excerpt() some posts are truncated and some are not
- Stripping tag from elements in post
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- wp trim function not working
- excerpt in template for specific page
- After the local installation of an old WP website I can see the homepage but I can’t access to the articles, why?
- Show full post only to loged-in users
- Read more opens attachment
- Automatically search and replace link in content (pages/posts)?