I have a field that stores a JSON string from YouTube. I wish to create a custom query that would sort by a value within the JSON. In a perfect world, a meta_key like this would work, but it obviously does not. Is there a way to do this?
$args = array(
'posts_per_page' => -1,
'post_type' => 'videos',
// video_json_string is the ACF field name
'meta_key' => 'video_json_string['items']['statistics']['viewCount']',
'orderby' => 'meta_value'
$query = new WP_Query($args);
I know I could create a new field and store the view count there by itself, but I want to see if it can be done in this fashion. Thank you for any help!