0

I can't remove a filter that added by media-tags plugin. it was originally added this way:

add_filter( 'attachment_fields_to_edit', 'mediatags_show_fields_to_edit', 11, 2 );

I tried to remove it this way:

remove_filter( 'attachment_fields_to_edit','mediatags_show_fields_to_edit', 11, 2 );

Where I did wrongly? How can I remove this filter?

3

It depends on the call sequence. Are you sure that the remove_filter is called after the add_filter and before the attachment_fields_to_edit filter is invoked? Add few trace statements and verify.

  • the original filter was added inside a function that hooked up with 'admin_init'. My remove_filter is hooked up with my plugin's init. I will try to change my hook to see how. thanks! – Jenny Jun 6 '12 at 6:47
  • You can use the same hook admin_init with a lower priority to ensure that your method is called later. – Dakshinamurthy Karra Jun 6 '12 at 6:50

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.