• Hi there,

    we have a block with a repeater containing an if on a link field:

    <?php foreach( $attributes['rezension'] as $inner ){ ?>
        <?php if ( $inner['link'] ) : ?>
            Button
        <?php endif; ?>
    <?php } ?>

    When inserted on a page and the link field is initially left empty, we get a warning in the frontend:

    Warning: Undefined array key „link“ in /htdocs/wordpress/wp-content/themes/gp-client/blocks/lazyblock-review/block.php on line 14

    After filling this field and saving and then emptying again the warning disappears.

    Any hint how to solve this?

    Regards
    Claudia

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

The topic ‘Repeater with if = warning “undefined array key” when initially empty’ is closed to new replies.