WordPress theme update prevents access to administrative pages

This content is 14 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

For days now, I’ve been banging my head against the wall on a problem with a WordPress website (not this one). I used an agency to develop a theme for me, but every time I applied it to the site, I lost access to the /wp-admin pages (in most browsers I saw a blank page, except in Firefox, where I could see the following characters: ). I only have access to the WordPress application (no database administration, or access to the web server itself), so the only way out was to ask the server administrators to restore the WordPress folders from backup, which takes time and gets embarrassing after a second attempt.

I’d seen John MacMenamin’s WordPress WP-Admin blank page fix post and thought I’d removed all whitespace from the top/bottom of functions.php but, after Alex Coles suggested that I look at the differences between Unix-style linefeeds and Windows carriage-return/linefeeds, Could this be the culprit in the case of the blank /wp-admin pages?I spotted the same strange characters at the head of the file (they showed up in windiff.exe as I was performing a file comparison). I don’t know how it got there but, each time I get a theme update, I have to manually remove what appeared to be a single byte from the head of the file using the nano editor on my Mac, which presented it as white space (I’m sure vi would do the job too), because not all text editors can see the offending character (certainly not Notepad on Windows, or TextEdit on a Mac).

This cost me a lot of time (and probably delayed the launch of the website too), so I thought it might be useful to flag up for others to benefit from my experience.

2 thoughts on “WordPress theme update prevents access to administrative pages

  1. I would imagine that your server has errors suppressed for security purposes. PHP may be writing errors to a log, but you probably don’t have access to the logs. What you could do is put
    <?php
    ini_set( 'display_errors', 1 );
    error_reporting( E_ALL & ~E_NOTICE );
    ?>
    somewhere near the start of the script. In this case, you would have seen something like this:

    Warning: Cannot modify header information – headers already sent by (output started at /path/to/www/wordpress/wp-content/themes/themename/functions.php:1) in /path/to/www/wordpress/wp-includes/pluggable.php on line 890

    which is much more helpful than the blank screen you were getting.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.