1

I'm using the Meta Box plugin to create custom post types and fields. There is a record type teachers, and I'm trying to display the lessons associated with him on the page of a certain teacher. The code looks like this:

$queryArgs = array(
            'post_type' => 'lessons',
            'order' => 'ASC',
            'posts_per_page' => -1,
            'orderby' => 'meta_value',
            'meta_key'  => 'lessons_teacher',
            'compare' => 'LIKE',
            'meta_query' => [
                [
                    'key'  => 'post_name',
                    'value'   => 'john-smith',
                ]
            ]
        );

and here it is not entirely clear how to compare lessons by the value of [post_name], because the field is an array, i.e. a set of keys - values... and [post_name] is the key to which, in fact, you need to refer..

Alexey
  • 11
  • 1

0 Answers0