WordPress: Disable All Shortcodes from the_content


The following code snippet will remove ALL shortcodes from the_content
Add the following code snippet to the functions.php of your theme

function remove_shortcode_from_index($content) {            
$content = strip_shortcodes($content);          
return $content; 
} 
add_filter('the_content', 'remove_shortcode_from_index');  

You can disable shortcodes from particular page, e.g Home Page

function remove_shortcode_from_index($content) {     
if ( is_home() ) {         
$content = strip_shortcodes($content);     
}     
return $content; 
} 
add_filter('the_content', 'remove_shortcode_from_index');  

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: