最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugin development - Is it possible to use the MySQL's ORDER BY FIELD() clause as part of the pre_get_posts hook?

programmeradmin1浏览0评论

I'm just curious if it is possible to use the ORDER BY FIELD() clause using the $query via pre_get_posts, or if I need to use a Custom Query for that.

Here is the code I've tested but it didn't work:

$query->set( 'orderby', 'FIELD(ID,5,3,4,1)' );

Thanks in advance!

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论