Hi @andras1234
We don’t have a built-in option for this, so you’ll need to write a custom PHP function that does it (see documentation). I found an article here that should provide some inspiration for your code: https://stackoverflow.com/questions/38764170/how-to-strip-all-visual-composer-shortcode-tags-from-wordpresss-post-content-fe.
Dear Developers! Thanks for the quick reaction. I tried the custom php function and attempted to paste the code on the sent instructions, but it did not work.
Can you help me describe how I can apply in your program on the link that was sent out?
The link shows a screenshot of the problem:
https://i.imgur.com/LqrXxDK.png
Thanks in advance!
Hi @andras1234
Here’s an example snippet:
function my_fix_content( $content ) {
$content = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $content);
// You might need to do additional processing for leftover shortcodes
// For example:
// $content = preg_replace('~(?:\[/?).*?"]~s', '', $content);
return $content;
}
Please keep in mind that this is just an example and you’ll need to adjust it yourself if it’s not working as desired.
Thanks for the code! However, you make a syntax error with the following message:
Parse error: syntax error, unexpected ‘;’, expecting ‘(‘ in your code on line 3
Can you fix it? Thanks in advance!
Hi @andras1234
There’s no syntax error in the code that I shared above. Please double check the code that you pasted in your function editor, it sounds like there’s a character missing somewhere.
Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad