Support

Account

Home Forums Add-ons Repeater Field WP Query if Sub Field exist

Helping

WP Query if Sub Field exist

  • Hi everyone,

    i have created with ACF an Repeater Field, called “videos” for my CPT “company”.
    In this Repeater Field i have one Field, called “video” for a youtube Link.

    Now I’d like to show with a Query all Companys who has a sub field created with an video link.

    I try it with this code:

    
    $itemArgs = array(
    'post_type'             => 'company',
    'pagination'            => false,
    'posts_per_page'        => '-1',
    'meta_query'            => array(
    array(
    'key'       => 'videos_%_video',
    'value'     => 'http://',
    'compare'   => 'LIKE',
    ),
    );

    Has anyone a Idea to solve the problem?

    Thanks a lot,
    Stefan

  • Hi @fried-dbm

    Please take a look at section 4, Sub custom field values, of this page: http://www.advancedcustomfields.com/resources/query-posts-custom-fields/.

    I hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘WP Query if Sub Field exist’ is closed to new replies.