Can you use add_filter() inside other function?

I think what you’re ACTUALLY looking to do is to apply_filters(). add_filter() registers a new filter, whereas apply_filters() does the filters that have been registered.

If that’s not what you’re looking to do, then you need to be aware that add_filter() needs to be run every time you want the filter applied. This allows plugins to be removed without having to unregister all their filters and generally keeps a wordpress install pretty clean…it also helps with security. A better question might encompass a broader scope, where you state what you’re trying to do, rather than having us try and troubleshoot your implementation of it.

tech