Skip to content
Advertisement

Posts not ordering by post__in

I am trying to display 3 blog posts that have been selected by the user in the admin. The order should go gridItem1, gridItem2 then gridItem3. I have set out my query below but it shows the selected posts but in date order not in the order I have outlined.

I have searched other posts and added in the 'surpress_filters' => true and the wp_reset_query(); but neither seemed to have helped.

Here is my code:

JavaScript

Does anyone know how to make them show in the order I have outlined? Thanks

Advertisement

Answer

You don’t need to use suppress_filters. You don’t need wp_reset_query either. The main problem is order_by which is incorrect. The correct form of using it is orderby.

Use the following query instead:

JavaScript

WP_QueryDocs

Let me know if you were able to get it to work!

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement