Notice: Undefined index: fix with isset [closed]

You have some problems with the way you are doing it.

The following line reads your settings in…

$settings = get_option( 'eddreldlc_options', $eddreldlc_options );

So settings looks like:

array(
    'loop_true' => array(
        'value' => 'true',
        'label' => 'True'
    ),
    'loop_false' => array(
        'value' => 'false',
        'label' => 'False'
    )
);

Your loop looks like the following

foreach( $eddreldlc_auto_play as $layout )

So what you are actually getting is the following for each $layout variable

$layout = array( 
    'value' => 'true',
    'label' => 'True'
);

Yet you are referencing the following for checked:

$settings['eddreldlc_auto_play']

This does not compute as there is no such index in your $settings variable.

Judging by your code, you probably mean the following there

checked( $layout['value'], 'true' );

Of course, you have some other problems in that code. I’d rewrite it as follows:

<?php
    $settings = get_option( 'eddreldlc_options', $eddreldlc_options );
    foreach( $eddreldlc_auto_play as $layout ) {
        $value = esc_attr( $layout['value'] );
        $checked = checked( $layout['value'], 'true', false );
        echo <<<HTML
<input type="radio" id="eddreldlc_layout_{$layout['value']}" name="eddreldlc_autoplay" value="{$value}" {$checked} />
<label for="eddreldlc_layout_{$layout['value']}">{$layout['label']}</label><br />
HTML;

    }
  • Your id is very prone to being stomped on so I made it more unique
  • Your name on the radio makes it look like you are setting the option in your site to stomp on the array you claim to be reading so I changed the name to avoid confusion on what is being expected.
  • I personally prefer heredoc notation as it makes for much easier reading

Anywise, fix the referenced index and you should be good to go.