I have a variable like this:
$post_content = get_the_content();
Here I want to remove some specific shortcode from the $post_content variable e.g I want to remove only this [video height="300" width="300" mp4="localhost.com/video.mp4"]
all other shortcodes and content formatting should be leaved intact.
How could this be done?
UPDATE:
I'm able to remove some specific shortcode by using code something like this ...
<?php
echo do_shortcode(
str_replace(
'[video height="300" width="300" mp4="localhost.com/video.mp4"]',
'',
get_the_content()
)
);
?>
But it is also removing all html tags/formatting of get_the_content()
. How to avoid it?