I am Using the Following Code and want to remove HTML All Elements.
<?php $exerpttext = substr(get_post_field('post_content', $post->ID), 0, 300);
if (!empty($exerpttext)) { echo $exerpttext.'....'; } ?>
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityI am Using the Following Code and want to remove HTML All Elements.
<?php $exerpttext = substr(get_post_field('post_content', $post->ID), 0, 300);
if (!empty($exerpttext)) { echo $exerpttext.'....'; } ?>
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.