Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter LienekeKoenen

    (@lienekekoenen)

    It took a while, I had to click on reset a couple times and turn my plugins on and off. But it works perfect now! Thanks!

    Thread Starter LienekeKoenen

    (@lienekekoenen)

    The information for the images is no longer stored in $field['value']. The information about the fieldtype is in $field['sub_fields'], here you can find if the singular field is ‘type’ image. But since you have to go inside the array of subfields to get the type, you are outside of the parent repeater field. The value’s for the images are stored in $field['value'] but not with the key ‘ID’ or ‘URL’. The key is the name of the field, which is also stored in the ‘sub_fields’.

    I wrote some code, but it’s not working. But at least you can see what not to do xD

    // ACF Repeater
    if ( $field['type'] == 'repeater' ) {
        if ( !empty( $field['sub_fields'] ) ) {
            foreach ($field['sub_fields'] as $subfields){
                if($subfields['type'] == 'image'){
                    $parent = get_field_object($subfields['parent']);
                    $name = $subfields['name'];
                    foreach($parent['value'] as $value){
                        $image = $value[$name];
                        if(!empty($image)){
                            if(is_array($image)){
                                array_push( $postmeta_images_acf_ids, $image['id'] );
                            }
                            else if(is_numeric($image)){
                                array_push( $postmeta_images_acf_ids, $image );
                            }else{
                                array_push( $postmeta_images_acf_urls, $this->core->wpmc_clean_url( $image ) );
                            }
                        }
                    }
                }
             }
        }
    }
    Thread Starter LienekeKoenen

    (@lienekekoenen)

    unfortunately it doesn’t solve the problem ?? Gotta find those images in the array, else it won’t see that the image is attached to the repeater field. I’ll see if I can find out where it’s stored. ??

    Thread Starter LienekeKoenen

    (@lienekekoenen)

    Hi Jordy,

    I got it working:

    Change line 129 in scan.php:
    if ( $subfield['type'] == 'image' ) {
    to
    if (is_array($subfield) && $subfield['type'] == 'image') {

Viewing 4 replies - 1 through 4 (of 4 total)