Very challenging: I have been looking for a solution to my Wordpress problem for weeks now and have already come close, but still not achieved any solution...
I created a wordpress website LOCALLY in WP 3.8 and then put it up online. Locally it works totally fine, but online I have a problem: I cannot login into my admin dashboard via /wp-login. All I get is a white screen.
After trying out different things I found out that the cause of the problem is the extra functions.php in my childtheme. I am using the Skeleton theme and in the childtheme folder I put a functions.php which only contains the code for a custom post type (for an events page).
My findings so far:
- Renaming the plugins folder and deactivating plugins doesn't help, I still can't login. I created a seperate wordpress website which a fresh Skeleton theme installation and put a functions.php with my custom post type code into the childtheme folder, but still: I can't login.
- The same trouble I have when I switch to other themes, for instance the standard WP themes.
- Login to my admin dashboard ALWAYS works (no matter what theme I am using) if I deactivate the extra functions-file by renaming or deleting it.
- When I see the white screen as a result of my login problem there are no errors displayed, although I put two lines of codes for displaying errors on top of the file (see below).
- Transfer-Typ in Filezilla is set to "Automatic". I then put the transfer type to "ASCII" for manually transferring the functions.php to my childtheme, but still no solution to my problem...
Maybe a server problem?
A friend included the functions-php locally in a wordpress installation of his and everything worked fine. So I am thinking about a possible server problem. Therefore I checked the log files of my domain provider in order to see which notifications come up after my login attempts:
For testing I logged in at 10:29h WITHOUT the extra functions.php file in the wordpress childtheme; and then at 10:30h I logged in WITH this file that then causes the login error. Here come the resulting notifciations:
++++++++++++++++ GENERAL LOGFILE: ++++++++++++++++
10:29h:
78.34.243.22 - as [06/Jan/2014:10:29:33 +0100] "POST /wordpresstest/wp-login.php HTTP/1.1" 302 970 "...mydomain/wordpresstest/wp-login.php?loggedout=true" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" "...mydomain"
78.34.243.22 - as [06/Jan/2014:10:29:34 +0100] "GET /wordpresstest/wp-admin/ HTTP/1.1" 200 62361 "...mydomain/wordpresstest/wp-login.php?loggedout=true" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" "...mydomain"
78.34.243.22 - as [06/Jan/2014:10:29:38 +0100] "GET /wordpresstest/wp-login.php?action=logout&_wpnonce=350e4eadb6 HTTP/1.1" 302 2211 "...mydomain/wordpresstest/wp-admin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" "...mydomain"
78.34.243.22 - as [06/Jan/2014:10:29:38 +0100] "GET /wordpresstest/wp-login.php?loggedout=true HTTP/1.1" 200 4510 "...mydomain/wordpresstest/wp-admin/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" "...mydomain"
10:30h:
78.34.243.22 - as [06/Jan/2014:10:30:11 +0100] "POST /wordpresstest/wp-login.php HTTP/1.1" 200 177 "...mydomain/wordpresstest/wp-login.php?loggedout=true" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" "...mydomain"
78.34.243.22 - as [06/Jan/2014:10:30:29 +0100] "GET /wordpresstest/wp-login.php HTTP/1.1" 200 4071 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" "...mydomain"
++++++++++ ERROR-LOG ++++++++++
10:29h -> NO error log notifications
10:30h -> YES, there are the following error log notifications:
[Mon Jan 06 10:30:12 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-login.php on line 415, referer: ...mydomain/wordpresstest/wp-login.php?loggedout=true
[Mon Jan 06 10:30:12 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-login.php on line 427, referer: ...mydomain/wordpresstest/wp-login.php?loggedout=true
[Mon Jan 06 10:30:12 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-includes/pluggable.php on line 678, referer: ...mydomain/wordpresstest/wp-login.php?loggedout=true
[Mon Jan 06 10:30:12 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-includes/pluggable.php on line 679, referer: ...mydomain/wordpresstest/wp-login.php?loggedout=true [Mon Jan 06 10:30:12 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-includes/pluggable.php on line 680, referer: ...mydomain/wordpresstest/wp-login.php?loggedout=true [Mon Jan 06 10:30:12 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-includes/pluggable.php on line 896, referer: ...mydomain/wordpresstest/wp-login.php?loggedout=true
[Mon Jan 06 10:30:29 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-login.php on line 415
[Mon Jan 06 10:30:29 2014] [error] [client 78.34.243.22] PHP Warning: Cannot modify header information - headers already sent by (output started at /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-content/themes/skeleton_childtheme/functions.php:1) in /is/htdocs/wp11219728_2Z29VZF37V/www/wordpresstest/wp-login.php on line 427
As it looks the functions.php in the childtheme causes the error log notifications! I am new to PHP and Wordpress so that I cannot interpret then.
- Maybe someone of you knows this problem and can interpret the error log notifcations?
- And maybe someone of you can even include the functions.php in one of his/her online wordpress sites and check if it also causes a login error when put into the childtheme folder?
Your help would be fantastic!!! :)
And here is the code of my extra functions.php file from my childtheme folder:
<?php
add_action( 'init', 'add_cpt_veranstaltungen' );
function add_cpt_veranstaltungen() {
$labels = array(
'name' => _x('Veranstaltungen', 'post type general name'),
'singular_name' => _x('Veranstaltung', 'post type singular name'),
'add_new' => _x('Hinzufügen', 'Veranstaltung'),
'add_new_item' => __('Neue Veranstaltung hinzufügen'),
'edit_item' => __('Veranstaltung bearbeiten'),
'new_item' => __('Neue Veranstaltung'),
'view_item' => __('Veranstaltung ansehen'),
'search_items' => __('Nach Veranstaltungen suchen'),
'not_found' => __('Keine Veranstaltungen gefunden'),
'not_found_in_trash' =>
__('Keine Veranstaltungen im Papierkorb'),
'parent_item_colon' => ''
);
$supports = array( 'title', 'editor', 'thumbnail', 'excerpt');
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'_builtin' => false,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array("slug" => "produkte"),
'capability_type' => 'post',
'hierarchical' => false,
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 20,
'supports' => $supports
);
register_post_type('veranstaltungen',$args);
}
add_action("admin_init", "cpt_veranstaltungen_meta_boxen");
add_action('save_post', 'cpt_veranstaltungen_speichern');
function cpt_veranstaltungen_meta_boxen(){
add_meta_box("uhrzeit-meta", "Uhrzeit", "cpt_veranstaltungen_feld_uhrzeit", "veranstaltungen", "side", "high");
add_meta_box("treffpunkt-meta", "Treffpunkt", "cpt_veranstaltungen_feld_treffpunkt", "veranstaltungen", "side", "high");
add_meta_box("kurzbeschreibung-meta", "Kurzbeschreibung", "cpt_veranstaltungen_feld_kurzbeschreibung", "veranstaltungen", "side", "high");
}
function cpt_veranstaltungen_feld_uhrzeit(){
global $post;
$custom = get_post_custom($post->ID);
$uhrzeit = $custom["uhrzeit"][0];
echo '<input name="uhrzeit" type="time" value="' . $uhrzeit . '"/>';
}
function cpt_veranstaltungen_feld_treffpunkt(){
global $post;
$custom = get_post_custom($post->ID);
$treffpunkt = $custom["treffpunkt"][0];
echo '<textarea name="treffpunkt">' . $treffpunkt . '</textarea>';
}
function cpt_veranstaltungen_feld_kurzbeschreibung(){
global $post;
$custom = get_post_custom($post->ID);
$kurzbeschreibung = $custom["kurzbeschreibung"][0];
echo '<textarea name="kurzbeschreibung">' . $kurzbeschreibung . '</textarea>';
}
function cpt_veranstaltungen_speichern(){
global $post;
update_post_meta($post->ID, "uhrzeit", $_POST["uhrzeit"]);
update_post_meta($post->ID, "treffpunkt", $_POST["treffpunkt"]);
update_post_meta($post->ID, "kurzbeschreibung", $_POST["kurzbeschreibung"]);
}
add_action( 'init', 'cpt_reg_tax' );
function cpt_reg_tax() {
register_taxonomy( "Datum",
array( "veranstaltungen" ),
array( "hierarchical" => true,
"label" => "Datum",
"singular_label" => "Datum",
"rewrite" => true));
}
add_filter("manage_edit-veranstaltungen_columns", "cpt_veranstaltungen_spalten");
add_action("manage_posts_custom_column", "cpt_veranstaltungen_neue_spalte");
function cpt_veranstaltungen_spalten($columns){
$columns = array(
// Schema: key --> Ausgabe
"cb" => "<input type=\"checkbox\" />", // standard
"title" => "Veranstaltung", // standard
"uhrzeit" => "Uhrzeit", // NEU
"treffpunkt" => "Treffpunkt", // NEU
"kurzbeschreibung" => "Kurzbeschreibung", // NEU
"date" => "Hinzugefügt" // standard
);
return $columns;
}
function cpt_veranstaltungen_neue_spalte($column){
global $post;
if ("uhrzeit" == $column) {
$custom = get_post_custom();
echo $custom["uhrzeit"][0];
}
elseif ("treffpunkt" == $column) {
$custom = get_post_custom();
echo $custom["treffpunkt"][0];
}
elseif ("kurzbeschreibung" == $column) {
$custom = get_post_custom();
echo $custom["kurzbeschreibung"][0];
}
}
+++ UPDATE +++
Removing the ?> at the end of the code does not help.
Still not solved the problem, but might help much: http://codex.wordpress.org/Answers-Trouble_Shooting#Headers_already_sent
Via this link I learnt that the first line of the functions.php causes some problem that affects other files (see error log notifications at 10:30h above). But what exactly can be wrong here? Maybe someone of you can test the file online in a wordpress installment?
+++ PROBLEM SOLVED! +++
Many thanx to Tasos Bitsios: He helped me finding out the problem. I opened the functions.php-file in a Hex Editor and saw that there are three characters in front of the php start tag that shouldn't be there. I removed these characters, saved the file and uploaded it on my server and voilá: LOGIN WORKS!