WordPress.org

Ready to get started?Download WordPress

Forums

Child Theme functions.php breaks admin (9 posts)

  1. aarky
    Member
    Posted 3 years ago #

    I am trying to create a child theme. When I include functions.php the site appears to work OK, but meta functions (login, logout, update post, etc.) create the Cannot modify header fault, like this:
    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

    There is no extra white space in functions.php.
    I have reduced functions.php to an open tag, comment, and close tag; the fault persists.
    The Twenty Ten theme exhibits this behavior, as does the Arjuna-X theme.
    I have disabled all plugins.
    Here's the functions.php file:

    <?php
    // comment
    ?>

    I've documented what I've done on this page:
    http://arkusinski.net/2011/05/child-wordpress-theme/

    I'm sure I am missing something obvious. Any help is appreciated.

  2. Digital Raindrops
    Member
    Posted 3 years ago #

    Remove the closing tag ?> in functions.php

    http://wordpress.org/support/topic/twentyten-child-theme-functionsphp-breaks-login?replies=6

    It is the WordPress coding standard to include closing PHP tags on files that are not expected to be edited.

    That excludes a theme's functions.php and wp-config.php.

    HTH

    David

  3. aarky
    Member
    Posted 3 years ago #

    The closing tag does not seem to be the issue here. Removing the closing tag has no effect. functions.php now looks like this:

    <?php
    // comment

    It does nothing, yet its very existence seems to cause the problem. BTW, I've tried this with a real function defined, and it makes no difference.

  4. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    What about a completely empty functions.php file - no tags, comments, or anything? Do you still get the same errors?

  5. Digital Raindrops
    Member
    Posted 3 years ago #

    Reading your post on the website, this happens with other themes and not just the twenty ten theme?

    I would deactivate all plugins and try again, if it is ok activate each plugin and test at each point, are there any membership or theme based plugins that may not work with child themes.

    I have a few child themes with a total of over 7000 downloads, try one of these then you will know if it is specific to your setup.

    HTH

    David

  6. aarky
    Member
    Posted 3 years ago #

    I've come back to this issue. Basically no progress since the last posts, but I have a hypothesis. It appears that the child theme works fine for browsing posts, but anytime it tries to write information, such as login, logout, post update, or leaving a comment, the problem manifests itself. So I suspect a permissions issue, rather than a syntax problem. Can anyone help with what permissions are needed by a child theme?

    I documented details on my blog:
    http://arkusinski.net/2011/05/child-wordpress-theme/#Summary

  7. frantsch
    Member
    Posted 3 years ago #

    Same problem here with WordPress 3.2 and the TwentyEleven theme! Any ideas to solve this problem are appreciated!

  8. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    @frantsch: no, really: start a new topic. Please stop hijacking other people's topics.

  9. frantsch
    Member
    Posted 3 years ago #

    @chip:
    all right, sorry blogpolice! I did so now:
    wordpress.org/support/topic/functionsphp-will-not-work-with-child-theme

Topic Closed

This topic has been closed to new replies.

About this Topic