I want to know which filter hook I should use that performs faster.

I did try both several times and I noticed that posts_search is a bit faster than using the combination of posts_where and posts_join

What is your take on this?

1 Answer
1

All of these hooks are called in a similar fashion and get passes similar data. Under normal circumstances there should be no meaningful performance difference between them.

One scenario I can think of is that if you aren’t properly targeting your code to specific queries and it runs in every query then posts_search might fire less time, because other two are conditional on suppress_filters in query being disabled.

Leave a Reply

Your email address will not be published. Required fields are marked *