I am using the Kirki plugin to extendthe standard WP customizer. I have enable a repeater to add new elements to my site dynamically, each of them needs to have its own image:

Kirki::add_field( 'touche_config', array(
    'type'        => 'repeater',
    'label'       => 'Discover Items',
    'section'     => 'touche_discover',
    'priority'    => 0,
    'row_label'   => array(
        'type'  => 'text',
        'value' => 'Discover Item',
    'settings'    => 'touche_discover_items',
    'default'     => array(
            'title' => 'Lorem ipsum dolor sit amet',
            'image_url' => 'http://placehold.it/820x1280',
    'fields' => array(
        'title' => array(
            'type'        => 'text',
            'label'       => 'Title',
            'default'     => 'Lorem ipsum dolor sit amet',
        'image_url' => array(
            'type'        => 'image',
            'label'       => 'Image',
            'default'     => 'http://placehold.it/820x1280',
) );


$touche_discover_items = get_theme_mod( 'touche_discover_items' );

to see an output.

The problem is that when I create a new item (or edit the current one) and upload a new image (which displays correctly inside the Customizer), it doesn’t outputs its URL. It outputs its number for some reason:

array(1) { [0]=> array(2) { ["title"]=> string(26) "Lorem ipsum dolor sit amet"  ["image_url"]=> string(2) "25" }

Same if I go with a foreach loops then, I get something like:

<img src="25" alt="...">

Any ideas?

Read more here: WP Kirki repeater doesn’t handle image uploads correctly


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: