Support

Account

Forum Replies Created

  • Woah! Cracked it thanks for your help John – turns out because the images are in an array I dont need a nested array in update_field – so this works!

     foreach( $imageurls as $url ) {
                    $carpic[]=
    				    array('field_5e70d223200ab' => $url);
    			}
    
    			update_field( 'field_5e70d211200aa', $carpic, $post_id); 

    Knew it would be my fault 🙂

  • Thanks for that John – I gave up and went home just after you sent it so didn’t reply 🙂
    I know its something silly I’m doing but this works and appends a single item

    	$imageurls = array_column( $vehicle->{ 'Images'}, 'ImageURI');
    
                foreach( $imageurls as $url ) {
                    $images= array(
    		        array('field_5e70d223200ab' => $url)
    		);
    	}
    			

    Its just giving 5 blank entries when $images is set to be an array ie $images[] = …

  • Thanks John

    I tried that but still nothing – here’s my output screen

  • Oh sorry John, thought I had included that – here it is

    update_field( ‘images’, $images, $post_id );

    I’ve also tried it with the field key for the repeater field

    Bit of an update – it now creates 5 blank entries in the repeater!

    Cheers

  • Fantastic, as always, thank you so much for your help John – its working perfectly and my sanity has been (mostly) restored!

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