Child WordPress Theme

Today I noticed that the Arjuna-X Theme has yet another update.  Based on the last update, I would expect my custom taxonomies to break with the update, until I edited the theme to add them back in.  I researched the question, “Can I customize a theme and have the changes persist when the theme is updated?”

The answer is “yes”, and the means to do this is the Child Theme.  I promptly created a child theme with a functions.php file that registered my custom taxonomies.  Child theme functions are loaded in addition to the parent theme functions.  Since I’ve already modified Arjuna-X to add my custom taxonomies, I am not sure what would happen when the child theme redefined existing functions.  This seemed like an excellent opportunity to run an experiment.

  1. Create a new Arjuna-X-Child theme and upload to the server.  Do not activate it yet.
    1. A child theme requires a style.css file.  Since I am not making any changes to styles, I used the

      @import url(“../arjuna-x/style.css”);

      statement to bring in the parent Arjuna-X styles in their entirety.

    2. Create a new functions.php file containing the code to register custom taxonomies.
  2. Update Arjuna-X.  This should cause my custom taxonomies to stop working.  Result: As expected, custom taxonomies stopped working.  I noticed that the theme update instructions in my blog dashboard recommend using child themes for modifications.  Funny how I did not notice that last week.
  3. Change blog theme to Arjuna-X-Child.  Custom taxonomies should begin working again.  Result: my child theme showed up in the dashboard.  I activated it and custom taxonomies are back.  That was easy!

Not so easy after all. The child theme broke the admin functions.  Login no longer works.  I had to revert back to the basic Arjuna-X theme and modify it, as before.

Time to continue the experiment.  The Arjuna-X functions.php file is quite complex and difficult for me to read.  I wonder if it is not structured in a way that is incompatible with the child theme I’m trying to create.  Hypothesis: The Twenty Ten theme will maximize compatibility, because it is developed as the default theme for WordPress.

The experiment proceeded as follows:

  1. Activate Twenty Ten as the blog theme.  Result: Appears to work as desired.  Theme does not have as many features as Arjuna-X does.
  2. Create a Twenty Ten Child theme and activate it.  This should add my custom taxonomies to the dashboard.  Result:  Blog displays OK, but when I attempt to Log Out, the dreaded “Cannot modify Header” warning appears.  I reset the active theme as Twenty Ten.
  3. Delete functions.php from the child theme.  This leaves only style.css.  Activate Twenty Ten Child theme.  Result: I was able to log out and back in.  No change in appearance from parent theme; working as expected.
  4. Add in the functions.php file exactly as shown in the WordPress example.  Result: The “Cannot modify header information” fault is back.  It appears that child themes are not working for some reason.
  5. I modified the function.php in the child theme to contain only <?php ?>.  No white space before or after the code.  Result: Problem persists.

At this time, I cannot use a child theme with a functions.php file.

2 May 2011 Update. I keep trying things, as this situation is bugging me.  A search of WP Forums gave a clue that perhaps a plugin is interfering with a child theme.  I disabled all plugins, but it did not help.

7 July 2011 Update. Lots of non-adventure life going on, so I haven’t done anything with the blog for a couple months.  I’m going to give up on child themes as I cannot figure out why I can’t get them to work.  I’ll have to get my taxonomies working by editing the main functions.php.  Then I’ll re-enable the plugins I had disabled a couple months earlier.

Because I don’t work with WordPress every day, I’ll document the steps I take in detail; that will help me later to remember what I did.

  1. I could not log in to edit the blog due to the “Cannot modify header information” fault from May.  Using FTP, I renamed the “twentyten-child” folder to “xxtwentyten-child”.  A page refresh displayed the dashboard.
  2. Since the twentyten theme is in fact simpler than Arjuna-X, I decided to try implementing my custom taxonomies in twentyten.  The hope is that it will be easier to learn the inside workings of WordPress.  First I copied the taxonomy code from my backup of Arjuna-X, then pasted it at the end of the functions.php file of twentyten, being careful not to leave any white space at the end of the file.  My custom taxonomies were back!
  3. In the process I noticed that WordPress 3.2 was out, and that it requires PHP 5.2.4 and MySQL 5.0.  I went to my ISP admin panel to verify the required versions were running.  MySQL was at 5, but PHP was version 4.  I changed PHP to version 5 (the exact version is 5.2.17).  This got me to wondering whether the old version of PHP was responsible for the troubles I’d been having with child themes.  So I ran another experiment.
    1. Verified that the twentyten-child functions.php file contained only the PHP start tag and a comment.
    2. Activated twentyten child theme.
    3. Better … the error is gone, but the theme does not display properly.  No widgets.
    4. I had been importing the style.css file in the child theme.  Now I deleted that file and copied style.css from twentyten to twentyten-child.  Now the child theme works just like the parent, widgets and all.
    5. Last step is to add in the functions.php file to the twentyten-child directory.  I did this and the custom taxonomies reappeared.  Yay!
    6. OK, not so Yay.  I seem to have duplicated the original problem. :(


I’ll summarize for the next time I come back to this.

Here’s the error line, which gets repeated multiple times:

Warning: Cannot modify header information – headers already sent by (output started at /homepages/9/d271285184/htdocs/wp-content/themes/twentyten-child/functions.php:1) in /homepages/9/d271285184/htdocs/wp-login.php on line 354

The error gets flagged on the first line of the child theme’s functions.php.  I know the problem is there because the line number (functions.php:1 in the example above) changes if I insert blank lines at the start of the file.  Here is the beginning of functions.php:

 * Register custom taxonomies


WordPress version:  3.1.2

PHP version:  5.2.17

MySQL version: 5.0

Parent theme: Twentyten

All plugins are disabled.


  • Problem manifests during admin type functions, such as login, logout, and editing of posts.
  • Problem is always associated with the PHP start tag in the child theme’s functions.php file.  Line number of the warning moves with the start tag as blank lines are added to start of file.
  • Problem does not manifest if the code in functions.php is directly added into the parent theme’s functions.php.
  • Problem does not manifest for non-admin functions such as navigating posts.
  • Problem does manifest for leaving comments.  Comment will post, though the error occurs.  No problem if there is no functions.php in the child theme folder.


  • Using the latest versions of PHP and My SQL.
  • WordPress 3.1.2 should not have this problem.  I will update to 3.2 soon, but don’t expect anything to change.
  • The child theme’s functions.php has no white space at the end.
  • Tried with and without a closing PHP tag.  No difference.
  • Found some comments on the net that the opening PHP tag should have a trailing space.  Tried with and without; no difference.  Also tried the opening tag using the two variants below, also with and without trailing spaces, with no difference.
  • My text editor allows end of lines to be of three variants.  I tried all three without effect:
    • Unix (LF).  My server is Linux so this should be the best choice.
    • Mac (CR).
    • Windows (CRLF)
  • I suspected a permissions problem.  Admin functions and leaving comments differ from browsing posts by writing data.  So I tried the following:
    • Add group write privilege to wp-content folder and contained files.  Did not help.


Here are the files in the child theme folder:

Theme Name: Twenty Ten Child
Description: Child theme for the Twenty Ten theme.  Adds custom taxonomies.
Author: Andy Arkusinski
Template: twentyten

@import url("../twentyten/style.css");


* Register custom taxonomies
add_action( 'init', 'create_my_taxonomies', 0 );

function create_my_taxonomies() {
register_taxonomy( 'place', 'post', array( 'hierarchical' => false, 'label' => 'Place', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'history', 'post', array( 'hierarchical' => false, 'label' => 'History', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'activity', 'post', array( 'hierarchical' => false, 'label' => 'Activity', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'device', 'post', array( 'hierarchical' => false, 'label' => 'Device', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'software', 'post', array( 'hierarchical' => false, 'label' => 'Software', 'query_var' => true, 'rewrite' => true ) );

6 thoughts on “Child WordPress Theme

  1. Hello, I had the same problem today… I don’t know if you managed to resolve yours. Anyhow, I posted it in my blog, but I also wanted to share the solution here too.

    For me what worked is, inside the functions.php for the child theme, DON’T put the closing ?> tag for php. I don’t know why it worked, but it worked, and I didn’t notice any breaking anywhere else…
    Hope it helps

  2. Pingback: WordPress Update | Digital Adventures UNITED STATES

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>