I’m trying to remove the shortcodes from a child theme.
In my functions.php file (for the child theme), I’ve put:
function my_remove_shortcode(){
return '';
}
add_shortcode('entry-twitter-link', 'my_remove_shortcode');
Where entry-twitter-link is a shortcode created in the parent. However, the entry still shows up on my posts. Ideas on what’s wrong?
2 Answers
Try this out. Remove the already added shortcode then add the new shortcode on the init hook.
function shortcode_cleaner() {
remove_shortcode( 'entry-twitter-link' ); // Not exactly required
add_shortcode( 'entry-twitter-link', 'my_remove_shortcode' );
}
add_action( 'init', 'shortcode_cleaner' );
function my_remove_shortcode(){
return '';
}