There is add_action() function inside function which is callback for add_shortcode(). Any idea how to remove this action with the help of custom plugin? Should I hook to any action which is called later then add_shortcode() function? I do not want to removing and re-adding shortcode, because there is huge function beyond it.
Simple example:
function test_shortcode() {
... other code ...
add_action( 'some_hook', 'custom_function');
... other code ...
}
add_action( 'wp_head', 'setup_theme' );
function setup_theme() {
... other code...
add_shortcode( 'test', 'test_shortcode' );
... other code ...
}
I need to remove custom_function() from this shortcode.
Thank you for your help…
This might not answer your question, but the size of the shortcode function itself does not make much of a difference for removing and re-adding. Short or long functions take the same time here.
So don’t hinder yourself removing the shortcode (
remove_shortcode
) because of the size of the function (huge), just remove it if you want to remove it, regardless how big it is:Have you considered
remove_action( 'some_hook', 'custom_function');
?OK, I found a way. Function add_shortcode is called for the_content filter with priority 11 (after wpautop). So, to remove custom_function() has to be done with the help of this filter (also with priority 11). Solution?
Works well for me. Thank you all for ideas!
Found the code bellow on https://gist.github.com/1887242
Seems like it does the job 😉