WordPress.org

Support

Support » How-To and Troubleshooting » Query for Sorting Post by Post Meta Fields

Query for Sorting Post by Post Meta Fields

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here is some sample code that I believe will do what you want:

    http://pastebin.com/p5mv7625

    Note that it sorts on the date published. If you want to sort on date modified, change this line:

    $mam_global_orderby = "sort_key, $wpdb->posts.post_date DESC";

    to this:

    $mam_global_orderby = "sort_key, $wpdb->posts.post_modified DESC";

    Thanks very much. That worked perfectly 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Query for Sorting Post by Post Meta Fields’ is closed to new replies.