admin管理员组

文章数量:1130349

I have a need to sort the search results so that a custom post type "authors" is always at the top, followed by all other post types sorted by relevance.

I've found numerous examples about altering the query for one or the other of these two conditions but not both together.

THe issue is that sorting for one post type needs to happen in the mySQL, while a sort by relevance is a WordPress function. I'm not seeing a practical way to get both in the same filter.

Thanks!

I have a need to sort the search results so that a custom post type "authors" is always at the top, followed by all other post types sorted by relevance.

I've found numerous examples about altering the query for one or the other of these two conditions but not both together.

THe issue is that sorting for one post type needs to happen in the mySQL, while a sort by relevance is a WordPress function. I'm not seeing a practical way to get both in the same filter.

Thanks!

本文标签: How to use multiple orderby conditions on query search results (orderby one post typerelevance)