0

Is it bad practice to add a filter within a filter for wordpress?

Say for example, You only want this filter to run within the callback function of another filter, and then remove said filter before the function finishes, so that the filter does not affect the site outside of this function.

2
  • Not necessarily, but it is sort of a messy workaround. Do you have an example? Apr 11 at 13:16
  • The example I was thinking of when I wrote this was having the filter wp_mail_content_type within wp_new_user_notification_email to convert the content type within the header to HTML from plain text, but there was a better way of doing it that I ended up using. I was curious if it was generally bad practice to put a filter within a filter even after the fact, so I asked that here anyways. @JacobPeattie Apr 12 at 18:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.