Skip to main content
Spell typo fix
Source Link
Anwer AR
  • 1k
  • 10
  • 19
$options = get_option( 'chec_settings' );
//Error message on line bellow
if ( is_array( $options ) && $options['chec_checkbox_field_0'] == '1' ) {
    echo 'Checked';
} else {
    echo 'Unchecked';
}

itif the value is not checked it will not saved itsave in db. soSo check if the $options is array.

$options = get_option( 'chec_settings' );
//Error message on line bellow
if ( is_array( $options ) && $options['chec_checkbox_field_0'] == '1' ) {
    echo 'Checked';
} else {
    echo 'Unchecked';
}

it the value is not checked it will not saved it db. so check if the $options is array.

$options = get_option( 'chec_settings' );
//Error message on line bellow
if ( is_array( $options ) && $options['chec_checkbox_field_0'] == '1' ) {
    echo 'Checked';
} else {
    echo 'Unchecked';
}

if the value is not checked it will not save in db. So check if the $options is array.

deleted 33 characters in body
Source Link
Anwer AR
  • 1k
  • 10
  • 19
$options = get_option( 'chec_settings' );
//Error message on line bellow
if ( array_key_existsis_array( 'chec_checkbox_field_0', $options ) && $options['chec_checkbox_field_0'] == '1' ) {
    echo 'Checked';
} else {
    echo 'Unchecked';
}

it the value is not checked it will not saved it db. so check if the array has chec_checkbox_field_0$options keyis array.

$options = get_option( 'chec_settings' );
//Error message on line bellow
if ( array_key_exists( 'chec_checkbox_field_0', $options ) && $options['chec_checkbox_field_0'] == '1' ) {
    echo 'Checked';
} else {
    echo 'Unchecked';
}

it the value is not checked it will not saved it db. so check if the array has chec_checkbox_field_0 key.

$options = get_option( 'chec_settings' );
//Error message on line bellow
if ( is_array( $options ) && $options['chec_checkbox_field_0'] == '1' ) {
    echo 'Checked';
} else {
    echo 'Unchecked';
}

it the value is not checked it will not saved it db. so check if the $options is array.

Source Link
Anwer AR
  • 1k
  • 10
  • 19

$options = get_option( 'chec_settings' );
//Error message on line bellow
if ( array_key_exists( 'chec_checkbox_field_0', $options ) && $options['chec_checkbox_field_0'] == '1' ) {
    echo 'Checked';
} else {
    echo 'Unchecked';
}

it the value is not checked it will not saved it db. so check if the array has chec_checkbox_field_0 key.