• Resolved Towfiq I.

    (@tislam100)


    Hello everyone, few days ago I created a wp theme. When I turn on wp_debug.I get these errors :

    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: ang_breadcrumbs in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: ang_hide_social in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: ang_hide_tw in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: ang_hide_fb in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: ang_hide_ms in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: ang_hide_rss in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: a in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 172
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 174
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 177
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 174
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 177
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 174
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 177
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 174
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 177
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 174
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 177
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 174
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 177
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 174
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 177
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php:172) in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 181

    I have tried this method, but it doesnt work.

    this error driving me crazy. can anyone plz help??? ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Towfiq I.

    (@tislam100)

    here is my themes functions.php
    https://pastebin.com/iPA5iDz0

    Thread Starter Towfiq I.

    (@tislam100)

    here is my themes functions.php
    https://pastebin.com/iPA5iDz0

    Anonymous User

    (@anonymized-3085)

    The header error is as a direct result of the previous errors – so don’t worry about that for now.

    I’d have to see the code to be certain – but it looks like you are use a variable that wasn’t set up.

    example:
    if ($_GET["variable"] == 'a')
    and you might need to use:
    if (isset($_GET["variable"]) && $_GET["variable"] == 'a')

    [edit: you replied whilst I wrote this]

    Anonymous User

    (@anonymized-3085)

    Ok line 172 has this:
    update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }

    $value[‘id’] is the issue, it doesn’t appear in every $value array, just some of them. In fact can lines 171 & 172 be deleted?

    Thread Starter Towfiq I.

    (@tislam100)

    thank you so much for your reply.

    I deleted the two lines(171 & 172) and gave every an id.
    Now I am getting 3 lines of errors.
    here is the edited functions.php
    and
    the new errors:

    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php  on line 180
    
    Notice: Undefined index: id in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 183
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php:180) in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 187

    Anonymous User

    (@anonymized-3085)

    I can’t spot where the issue is this time. So what I’d normally do (others almost certainly have easier solutions) is use a simple:

    echo '<pre>';
    print_r($value);
    echo '</pre>';

    to find whether id was indeed set or not.

    I’d use this before line 179.

    Thread Starter Towfiq I.

    (@tislam100)

    thank you for your reply. that triggered different error.
    But, I think I narrowed down the problem. here is my latest functions.php

    Now, when I save my theme option I get these errors:

    Notice: Undefined index: ang_temp in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php  on line 147
    
    Notice: Undefined index: ang_breadcrumbs in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
    
    Notice: Undefined index: ang_hide_social in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
    
    Notice: Undefined index: ang_hide_tw in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
    
    Notice: Undefined index: ang_hide_fb in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
    
    Notice: Undefined index: ang_hide_ms in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
    
    Notice: Undefined index: ang_hide_rss in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 147
    
    Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php:147) in C:\xampp\htdocs\wordpress\wp-content\themes\Angelia\functions.php on line 156

    I tried to remove these two lines as you suggested:

    foreach ($options as $value) {
                        update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }

    It doesn’t trigger any error but then the theme settings doesn’t save.

    BTW I am calling the theme options into my template files like this:

    <?php
    //allows the theme to get info from the theme options page
    global $options;
    foreach ($options as $value) {
            if(isset($value['id'])){if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; }
        else { $$value['id'] = get_option( $value['id'] ); }}
        }
    ?>
    Anonymous User

    (@anonymized-3085)

    You need another
    if( isset( $_REQUEST[ $value['id'] ] ) ) {
    before line 147.

    Thread Starter Towfiq I.

    (@tislam100)

    yeah just figured that out few minutes ago. works without error now. thank you so much for your effort.

    ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Cannot modify header information – headers already sent by’ is closed to new replies.