Support

Account

Home Forums ACF PRO Get the final field of the chain,which is in => repeater->field->repeater->FIELD

Solving

Get the final field of the chain,which is in => repeater->field->repeater->FIELD

  • The final field is PASSWORD, as I mark in the image
    This is the code of how I tried to get the field..
    ACF structure:
    repeater_machines
    => country
    repeater_password
    => password

    add_filter('posts_where', 'yanco_posts_where');
    function yanco_posts_where( $where ) {
        $where = str_replace( "meta_key = 'repeater_machines_password_repeater_$", "meta_key LIKE 'repeater_machines_%_password_repeater_%", $where );
        return $where;
    }
    
        if(isset($_GET['password'])) {
            $password = sanitize_text_field( $_GET['password'] );
            $meta_query[] = array(
                // 'key' => 'repeater_machines_$_password', // Format: repeater_field + _ + $ + _ + repeater_sub_field password_repeater
                'key' => 'repeater_machines_$_country_password_repeater_$_password',
                'value' => $password,
                'compare' => '='
            );
        }
  • 
    'repeater_machines_$_country_repeater_password_$_password'
    
    
    $where = str_replace( "meta_key = 'repeater_machines_$_country_repeater_password_$", "meta_key LIKE 'repeater_machines_%_country_repeater_password_%", $where );
    
  • I tried to do like you write, but when I put this line
    repeater_machines_$_country_repeater_password_$
    It considers that this part of the code $_country_repeater_password_ is the variable
    Undefined variable: _country_repeater_password_

  • Can you help me to handle with this issue ?

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.