0

I want to hide most of the backend links added by TinyMCE Templates plugin. I have problem with 'Copy to a new template' link inside Publish box. Plugin code:

add_action('post_submitbox_start', array(&$this, 'post_submitbox_start'));

I try (and it doesn't work):

function remove_post_submitbox_link(){
    global $tinymceTemplates;
    remove_action('post_submitbox_start', array( $tinymceTemplates, 'post_submitbox_start' ) );
}
add_action('plugins_loaded', 'remove_post_submitbox_link', 11);

Why that doesn't work?

0

Whilst you've got the right idea, it won't work in this case. Taking a look at the source code, the class is simply instantiated without an assign. There's no way to get a hold of $this from outside the class, and so no way for you to remove the hooks it attaches itself to.

This is why I'm a strong advocate of static methods in plugins. I would suggest contacting the author or TinyMCE Templates & asking if he would consider moving to this style of coding, or at least assigning the class instance to a global variable so that your code will indeed work.

Short term fix? Edit the plugin file & remove the add_action line, or use remove_all_actions( 'post_submitbox_start' ), though do so with extreme caution!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.