0

It's quite long to explain, but i'll try to make it short.

I made a plugin that scrapes content from remote websites; then converts each content request to a post (custom post type). I assign those "automated" posts to a bot user that I created in my Wordpress.

When displaying my posts in a loop; I would like to give a lower priority to the posts that have been created with this bot.

Thus I would like to reorder them by taking apart the posts from the bot and put them below the others.

How would you do that ?

Thanks a lot !

  • If you're inserting the posts with the bot, why not give those a higher menu_order which is $post->menu_order or is the Page Attributes box under Pages. Anyway, this will allow you to order your query by 'orderby' => 'menu_order, 'order' => ASC'. – Howdy_McGee Nov 1 '17 at 21:02
  • That could be interesting, but I was wondering how to do this with filters... ? – gordie Nov 1 '17 at 21:34
  • If you're creating your own WP_Query to display posts you could just pass those parameters in. Then there's the pre_get_posts hook which allows you to modify main queries. – Howdy_McGee Nov 1 '17 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.