'...'] or ['0' => '...'] if ( isset( $raw_value['url'] ) && is_string( $raw_value['url'] ) ) { $value = $raw_value['url']; } else { // take the first scalar string in the array, or empty string $first = reset( $raw_value ); $value = is_string( $first ) ? $first : ''; } } elseif ( is_object( $raw_value ) ) { // very defensive: some code might pass an object with ->url $value = isset( $raw_value->url ) && is_string( $raw_value->url ) ? $raw_value->url : ''; } else { $value = (string) $raw_value; } $image_preview = $value !== '' ? '' : ''; $field_template = '
%5$s

%4$s

'; $field_template = apply_filters( $id_name, $field_template, $args ); printf( $field_template, esc_html( $args['field']['label'] ), // %1$s == Label $id_name, // %2$s == ID & Name esc_attr( $value ), // %3$s == Value (Image URL) $args['field']['desc'], // %4$s == Description $image_preview // %5$s == Image Preview HTML ); ?>