I currently have the following code where I filter by the page template;
$pages = get_pages( array(
‘post_type’ => ‘page’,
‘meta_key’ => ‘_wp_page_template’,
‘meta_value’ => ‘unit.php’,
‘hierarchical’ => 0
) );
I would also like to sort by an ACF field so would need to add something like;
‘meta_key’ => ‘status’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘DESC’
Is it possible to get both meta_key parts to work together?
get_pages
and stick toWP_Query
, or if you must,get_posts
, you can set thepost_type
topage
– Tom J Nowell♦ Mar 7 '18 at 17:21