On some themes, or possibly versions of WordPress?, the priority parameter stops the filter from working.
Simply removing the priority parameter for those affected makes it work again.
How can I make a universal solution so that I don’t have to keep doing that? When possible, the priority should be set very high to make sure it’s one of the last things processed.
add_filter('the_content', 'my_filter', 9999);
Thanks!
Normally priority is in effect always. If you do not specify a priority it’s a default value of 10. If you want to ensure it’s later, take a higher value, like
9999
.However other plugins can remove your filters or discard them. Probably they did so after the 10 priority but prior your 9999 priority.
So you always need to track that down on an individual installation where the problem occurs. Try to find out which is the value that break things.
Another method is to monitor all hooks and filters.