Tin tức

Rarst wrote — august 28, 2014 8:36

Your checks inside pre_get_posts are wrong. By using function conditionals you will modify all (!) queries on matching page, not just main query. The conditionals used should be methods on passed query object. is_main_query() is special kind of disaster. It’s not actually telling you what you would guess from the name, useless in practice, and so misleading they had to add error message inside of it especially not to use it in pre_get_posts.

Hotline: 0985.442.034 Nhận tư vấn ngay Kết nối trên Zalo Lên đầu trang