Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

stonylake on "get_the_content without url from embedded video"

$
0
0

For a kind of search function I need the posts text without html tags and without embeeded stuff.

Currently I use

$text = get_the_content('');
	$text = apply_filters('the_content', $text);
	$text = strip_shortcodes($text);
	$text = str_replace(']]>', ']]>', $text);
	$text = strip_tags($text);

It works so far, but if a posts contains embedded vidoes, there is the url of the video included in $text. This is undesired.

For example: get_the_content has

This is my dem video:
<video class="wp-video-shortcode" id="video-15-1" width="640" height="360" preload="metadata" controls="controls"><source type="video/mp4" src="pathtouploaded.mp4" />pathtouploaded.mp4</video>
Is it great?

After apply_filters, strip_shortcodes, str_replace, strip_tags it is

This is my dem video: pathtouploaded.mp4 Is it great?

But what I want is to get only

This is my dem video: Is it great?

Thanks for your help.


Viewing all articles
Browse latest Browse all 8245

Trending Articles