Title: After update the child function.php is wrong
Last modified: October 3, 2020

---

# After update the child function.php is wrong

 *  [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/)
 * After the last update, the page no longer works properly. I get white page when
   I save posts, the pictures in the media library are gone, several other functions
   are just white.
    When I deactivate child, everything will be fine again but not
   the look I want. I have tested different methods and circled the error to the
   code in child function.php which looks like this now:
 *     ```
       <?php
       /* 
        * Child theme functions file
        * 
        */
       function colormag_child_enqueue_styles() {
   
       	$parent_style = 'colormag_style'; //parent theme style handle 'colormag_style'
   
       	//Enqueue parent and chid theme style.css
       	wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); 
       	wp_enqueue_style( 'colormag_child_style',
       	    get_stylesheet_directory_uri() . '/style.css',
       	    array( $parent_style ),
       	    wp_get_theme()->get('Version')
       	);
       }
       add_action( 'wp_enqueue_scripts', 'colormag_child_enqueue_styles' );
   
       ?>
       ```
   
 * Also ran WP debug and it also said that there is error in the code above.
    How
   do I fix the error?

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

 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13487604)
 * The WP error message:
 * > Warning: Cannot modify header information – headers already sent by (output
   > started at /customers/5/8/e/mysite.se/httpd.www/wp-content/themes/colormag-
   > child/functions.php:1) in /customers/5/8/e/mysite.se/httpd.www/wp-includes/
   > functions.php on line 6270
   >  Warning: Cannot modify header information – headers
   > already sent by (output started at /customers/5/8/e/mysite.se/httpd.www/wp-
   > content/themes/colormag-child/functions.php:1) in /customers/5/8/e/mysite.se/
   > httpd.www/wp-admin/includes/misc.php on line 1310 Warning: Cannot modify header
   > information – headers already sent by (output started at /customers/5/8/e/mysite.
   > se/httpd.www/wp-content/themes/colormag-child/functions.php:1) in /customers/
   > 5/8/e/mysite.se/httpd.www/wp-admin/admin-header.php on line 9
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13487763)
 * Have been troubleshooting for a few hours now.
    Cannot find fault in child. Has
   renamed all my files in child so that the flow only flows through child without
   going through any code, yet it is the same error. When I activate Colormag so
   that it does not use child everything works again Therefore, I think the fault
   lies in Colormag in the part that connects to child. The error also occurred 
   2020-09-29, that was when Colormag was updated.
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
 *  [Ashish – ThemeGrill Support](https://wordpress.org/support/users/themegrillteam/)
 * (@themegrillteam)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13488003)
 * Hi [@workmannen](https://wordpress.org/support/users/workmannen/),
    While checking
   the error message, it seems to cause by the child theme. Can you try switching
   to ColorMag parent theme and check if you still get the problem? Also, can you
   provide the site URL so that we can check?
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13488018)
 * I now only use Colormag, then it works well. When I activate child, it will be
   the errors I described. It will be the same mistake if I create a new child theme
   with only the code that should be and nothing else.
 * [https://www.sigmag.se/](https://www.sigmag.se/)
 * I will delete the web address the next time you reply.
 *  [Ashish – ThemeGrill Support](https://wordpress.org/support/users/themegrillteam/)
 * (@themegrillteam)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13492462)
 * Hi [@workmannen](https://wordpress.org/support/users/workmannen/)
    Do you need
   help with figuring out what is causing the problem in the child theme? If yes,
   please contact us via [http://themegrill.com/](http://themegrill.com/) Chat Support
   mentioning this support thread and we’ll help you with this.
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13493435)
 * Thanks!
    I will test a little myself first. If this is not possible, I will contact
   you.
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13504172)
 * Now (2020-10-07) my second blog with ColorMag child stopped working.
    The page
   contains a message from WordPress: “A critical error has occurred on your site.”
   2 blogs with the same error a few days in a row ??
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13504450)
 * > Now (2020-10-07) my second blog with ColorMag child stopped working.
   >  The page
   > contains a message from WordPress: “A critical error has occurred on your site.”
   > 2 blogs with the same error a few days in a row ??
 * The error with the other site did not go away when I deleted child. The error
   continues in the same way after. It looks like the bug is in the ColorMag Theme
   and came upon latest update but did not show up right away.
 * Message from Worpress:
    —————- Hey! As of WordPress 5.2, there is a built-in 
   feature that can detect when any extension or theme is causing a serious error
   on your site and informs you via this email that is sent automatically.
 * In this case, WordPress has detected an error **with your theme, ColorMag**.
 * Start by visiting your website ([https://www.*****.se/](https://www.*****.se/))
   and check if you notice any visible problems. Then go to the page where the problem
   occurred ([https://www.*****.se/wp-admin/admin-ajax.php](https://www.*****.se/wp-admin/admin-ajax.php))
   to check if you see anything there.
    —————- I’m now doing a restore from a previous
   back up.
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
 *  [Ashish – ThemeGrill Support](https://wordpress.org/support/users/themegrillteam/)
 * (@themegrillteam)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13506638)
 * While checking the site, I couldn’t see any error message. Can you contact us
   via [http://themegrill.com/](http://themegrill.com/) Chat Support so that we 
   can discuss this in detail and help you out?
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13509448)
 * I sent you a message a couple of days ago.
 * The reason it works now is that I installed a backup and disconnected child.
 *  [Ashish – ThemeGrill Support](https://wordpress.org/support/users/themegrillteam/)
 * (@themegrillteam)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13521309)
 * [@workmannen](https://wordpress.org/support/users/workmannen/)
 * Since the problem appears from the child theme, we couldn’t debug what is causing
   the problem. So, please contact us via [http://themegrill.com/](http://themegrill.com/)
   Chat Support as I asked before so that we can help you better with this.
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13521879)
 * I have emailed you and you have replied.
 * Can say that one of my sites, the one that went wrong a few days after the first
   one, I have reactivated the Child theme. Now it has worked in for several days
   without any problems.
 * I have not done anything with the sites at all. It just went wrong all of a sudden.
   I still have not done anything with the sites but when I activated cild on one
   of the sites it works again. Have not tested the other site yet.
 * I’m starting to think that the software in the server has been updated and that
   several people had problems then a new update was made and everything works again(
   my guess).
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13524764)
 * I want to get to the bottom of why the child theme does not work. As I described
   earlier, I get several different strange errors. Among other things, the pictures
   are not visible in the media library so I can not add pictures to my posts. Several
   pages in admin also turn white when I click on the functions. I got one of my
   sites to work with child again. I deleted the child directory and uploaded the
   ColorMad original directory. Then it worked. My other web page I deleted all 
   files and all code in the child directory except function.php. In that file, 
   I deleted all code except the original code. Continued the same error !!!
 * Now I’ll find out why it does not work:
    I have two test pages. One that I uploaded
   a brand new child directory I saved from ColorMag online and the other I still
   have the directory that does not work. I only have function.php and only the 
   original code. This is how it looks:
 * ………………………
    The code that works in function.php: /* * Child theme functions file**/
   function colormag_child_enqueue_styles() {
 *  $parent_style = ‘colormag_style’; //parent theme style handle ‘colormag_style’
 *  //Enqueue parent and chid theme style.css
    wp_enqueue_style( $parent_style, 
   get_template_directory_uri() . ‘/style.css’ ); wp_enqueue_style( ‘colormag_child_style’,
   get_stylesheet_directory_uri() . ‘/style.css’, array( $parent_style ), wp_get_theme()-
   >get(‘Version’) ); } add_action( ‘wp_enqueue_scripts’, ‘colormag_child_enqueue_styles’);
 * ………………………
    The code that does not work in function.php: /* * Child theme functions
   file * */ function colormag_child_enqueue_styles() {
 *  $parent_style = ‘colormag_style’; //parent theme style handle ‘colormag_style’
 *  //Enqueue parent and chid theme style.css
    wp_enqueue_style( $parent_style, 
   get_template_directory_uri() . ‘/style.css’ ); wp_enqueue_style( ‘colormag_child_style’,
   get_stylesheet_directory_uri() . ‘/style.css’, array( $parent_style ), wp_get_theme()-
   >get(‘Version’) ); } add_action( ‘wp_enqueue_scripts’, ‘colormag_child_enqueue_styles’);………………………
 * As you can see, the codes are exactly the same and the files they are in have
   exactly the same name and the two different directories also have exactly the
   same name but one of them works but not the other?!
 * I changed codes in the two function.php files, but the function.php that did 
   not work earlier also does not work after I changed codes?!
 * Now I create a new function.php instead of the function.php that does not work
   and put the latest code in it and test like this: I create a xxxx.txt file and
   rename it to fukition.php.
    NOW IT WORKS!!!
 * The error is that the function.php is of the wrong format!
 * Now comes the big questions:
    1. How can the file get the wrong format??? 2. 
   What are the different file formats on a server?
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
    -  This reply was modified 5 years, 7 months ago by [workmannen](https://wordpress.org/support/users/workmannen/).
 *  Thread Starter [workmannen](https://wordpress.org/support/users/workmannen/)
 * (@workmannen)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13527536)
 * Forget what I wrote above!
 * This is how it is:
    The functions.php file starts with <?php and ends with ?>
   When ColorMag was updated on September 29, 2020, the child theme stopped working.
   I have experimented with ALL the codes in the theme without success. I thought
   that for some reason it was the wrong file format in functions.php but when I
   started entering my codes in that file it stopped working again. I made one last
   attempt to solve the problem. I removed related code in functions.php and tested
   each time. When I deleted the last piece of code I happened to delete ?> also.
   Now the chill theme suddenly worked. I put back all the code except the last 
   one ?> and it still worked. After ColorMag updates, ?> must be deleted last in
   functions.php. Alternatively it should never be ?> but I have had it and it has
   worked until ClorMag was updated. Which of the options is the truth I do not 
   know but ?> last in functions.php should not be included.
 *  [Sakar Shrestha](https://wordpress.org/support/users/sakarrr/)
 * (@sakarrr)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13561431)
 * Hi [@workmannen](https://wordpress.org/support/users/workmannen/),
    Yes, the 
   end tag of PHP i.e. ?> was not supposed to be included at the end of functions.
   php file which was causing an issue in the child theme. So after removing the
   end tag ?> on the child theme it should work perfectly.
 * However, If you’re still having this issue we have fixed it in all our child 
   themes so you can download the child theme from our site and use it without any
   issue. Lastly, sorry for the trouble caused. 🙂

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

The topic ‘After update the child function.php is wrong’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/colormag/4.1.2/screenshot.jpg)
 * ColorMag
 * [Support Threads](https://wordpress.org/support/theme/colormag/)
 * [Active Topics](https://wordpress.org/support/theme/colormag/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/colormag/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/colormag/reviews/)

## Tags

 * [child](https://wordpress.org/support/topic-tag/child/)

 * 15 replies
 * 3 participants
 * Last reply from: [Sakar Shrestha](https://wordpress.org/support/users/sakarrr/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/after-update-the-child-function-php-is-wrong/#post-13561431)
 * Status: not resolved