Title: Extending query_posts
Last modified: August 18, 2016

---

# Extending query_posts

 *  [delaque](https://wordpress.org/support/users/delaque/)
 * (@delaque)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/extending-query_posts/)
 * I’ve tried to use a few plugins for displaying random posts on my page, but none
   of them seem to use the Loop, which seems like the “right” way of doing it from
   where I’m standing.
 * I have no real experience with building plugins for WP, so I figured this might
   be a good test run for me. It seems to me that the way to do this would be to
   use a hook right before the SQL query is sent to the server, and modify the query
   based on the randomizing logic. Does this seem like the right approach? Is there
   a hook just before the SQL query is posted to the server? Which one?
 * Alternatively, is there another way to create a new function to instigate the
   Loop? How do I create a new wp_query without the query_posts function? And am
   I being overzealous? Is there an easier way, that feels less of a hack, and more
   of an extension?

Viewing 1 replies (of 1 total)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/extending-query_posts/#post-327647)
 * Great questions, and ones that would be nice to have the answers to. But I’d 
   suggest joining the wp-hackers mailing list and asking them there, as you’ll 
   find a far greater developer 2 inquiry ratio than here, especially for the level
   of knowledge needed for WordPress internals of this sort.
 * [http://lists.automattic.com/mailman/listinfo/wp-hackers](http://lists.automattic.com/mailman/listinfo/wp-hackers)

Viewing 1 replies (of 1 total)

The topic ‘Extending query_posts’ is closed to new replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 1 reply
 * 2 participants
 * Last reply from: [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * Last activity: [20 years, 4 months ago](https://wordpress.org/support/topic/extending-query_posts/#post-327647)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
