At what priority does add_filter overwrite core functions?

There is no definitive answer to that because there is no limit to priorities high/low. Also plugins can be much less careful than core with this.

  • 11 is good number to be after default priority;
  • 20 to be late;
  • multiple thousands is good to be later than anyone who didn’t put more zeros in his thousands;
  • 9 is good number to be slightly earlier than default;
  • 1 to be really early;
  • -1 to be almost definitively first, because very few people remember that priorities can go negative.

Overall if you want to be sure you are before other functions you will have to dump everything that is added to hook in your specific setup and debug through that. You might need to create wrapper function to add your filters at specific load stage or even move other filters around.

And if you are making plugin for distribution you can guess, but you can’t be sure.

Leave a Comment

tech