Aleš Sýkora / November 28, 2023 / 4 comments

Order posts by ACF field in Oxygen Advanced query

Post summary: If you need filter your advanced query by ACF field, you need to use the field as a meta_key and then order by meta_value. You can set it up in Advanced query builder in Oxygen builder like this:

If you need filter your advanced query by ACF field, you need to use the field as a meta_key and then order by meta_value. You can set it up in Advanced query builder in Oxygen builder like this:

$the_query = new WP_Query($myquery(
	'post_type'			=> 'post_type_slug',
	'posts_per_page'	        => -1,
	'meta_key'			=> 'acf_field_slug',
	'orderby'			=> 'meta_value',
	'order'				=> 'DESC',   // or ASC
));
Oxygen Advanced query ordering by ACF field

Fuel my passion for writing with a beer🍺

Your support not only makes me drunk but also greatly motivates me to continue creating content that helps. Cheers to more discoveries and shared success. 🍻

4 comments

Share Your Thoughts