Title: Query Posts Pulling/Sorting Help
Last modified: August 20, 2016

---

# Query Posts Pulling/Sorting Help

 *  [jennygold](https://wordpress.org/support/users/jennygold/)
 * (@jennygold)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/query-posts-pullingsorting-help/)
 * I’m using this to pull in posts in a particular category and to sort by a custom
   date field:
 * query_posts(“cat=$cat_id&showposts=-1&meta_key=news_date&orderby=meta_value&order
   =DESC”);
 * My problem is that the “news_date” field is optional, but if this is not filled
   in, I still want the post to be pulled in (just without a date).
 * How can I achieve this? Can I somehow put a default value in the database so 
   that these posts will be pulled?
 * Thanks!

The topic ‘Query Posts Pulling/Sorting Help’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [jennygold](https://wordpress.org/support/users/jennygold/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/query-posts-pullingsorting-help/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
