Support » Fixing WordPress » WordPress search order by meta value

  • I want to sort my search result for custom post type by meta value, is it possible with any search query hook, or any other option?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • first check this page codex
    you can do something like that

    $args = array(
    	'meta_key'   => 'color',
    	'meta_value' => $_GET['meta_value'], //or $_POST['meta_value'] if the method is post
    );
    $query = new WP_Query( $args );

    Thanks for the reply, I want to add to search query, I have different hooks in use. I want to use “posts_orderby” filter if there is any possibility.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress search order by meta value’ is closed to new replies.