ashsaraga
6/20/2018 - 4:02 PM

Sort Archive by Meta Field

Sorts any archive by any meta field.

<?php
$the_key = '';  // Field Name to sort on 
$args = array(    'meta_key' => $the_key,
   'orderby' => 'meta_value',
   'order' => 'ASC'
);
global $wp_query;
query_posts(
	array_merge(
		$wp_query->query,
		$args
	)
);