• Sandy

    (@sandy786)


    Hi i’m getting error in my theme after set debug true can any body help me to resolve them

    Notice: Undefined index: in C:\xampp\htdocs\wp\wp-content\themes\mytheme\functions.php on line 396
    
    Notice: Undefined index: id in C:\xampp\htdocs\wp\wp-content\themes\mytheme\functions.php on line 399

    and
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wp\wp-content\themes\mytheme\functions.php:396) in C:\xampp\htdocs\wp\wp-content\themes\mytheme\functions.php on line 401

    here is my function.php from line 386 to 419

    function mytheme_add_admin() {
    
    global $themename, $shortname, $options;
    
    if ( isset($_GET['page']) && $_GET['page'] == basename(__FILE__) ) { 
    
      if ( 'save' == ( isset($_REQUEST['action'] ) && $_REQUEST['action'] ) ) { 
    
    		foreach ($options as $value) {
    		update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
    
    foreach ($options as $value) {
    	if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }
    
    	header("Location: admin.php?page=functions.php&saved=true");
    header("Location: themes.php?page=functions.php&saved=true");
    die;
    
    } else if ( 'reset' == ( isset($_REQUEST['action'] ) && $_REQUEST['action'] ) ) { 
    
    	foreach ($options as $value) {
    		delete_option( $value['id'] ); }
    
    	header("Location: admin.php?page=functions.php&reset=true");
    		header("Location: themes.php?page=functions.php&reset=true");
    
    die;
    
    }
    }
    
    add_theme_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • If you want debug information you get debug information. If you don’t know what to do with it I’d suggest to leave it alone then.

    This is very basic PHP behaviour, you might want to find an online free course or so to catch up.

    Hi @sandy. Could you fix it? I’m having exactly the same problem. I know it was 7 months ago, but an answer would be very helpful for me. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting Error in Function PHP After Debug set true’ is closed to new replies.