Support » Fixing WordPress » change post order from by date to by meta key value

  • Hi,
    I’m trying to change the sort order of posts displayed in the archive/search page to sort by a meta key value. My meta key is ‘work’ and the value is numerical.

    I think I’m suppose to add the following code somewhere, but I’m not quite sure where’s the best place to add it:
    $query = new WP_Query( array ( 'orderby' => 'meta_value', 'meta_key' => 'work' ) );

    I’m using a child theme.

    Any help will send waves of good karma your way.
    Thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘change post order from by date to by meta key value’ is closed to new replies.