WordPress Troubleshooting

From DreamHost
Jump to: navigation, search

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

General Debugging

If you find that your site isn’t working correctly, there are some things you can do to find out what’s happening. First, look for an error message. That can help you determine if the issue is a plugin or your theme. You can also do the most basic of WP debugging tests: disable your plugins and change your theme to Twenty Fifteen.

Once you find out who the culprit is, please contact the developer directly. All WordPress.org hosted plugins and themes have a support forum (go to https://wordpress.org/support/theme/THEMENAME or https://wordpress.org/support/plugin/PLUGINNAME and leave a post explaining what happened.

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 can either use he command line or edit the database directly.

Command Line

  1. Connect to your server via SSH
  2. Type the following to get a list of all available themes: wp theme status
  3. Type the following to change your theme: wp theme activate twentyfifteen

That's it! If you don't have twentyfifteen, you can install and activate it in one command: wp theme install twentyfifteen --activate

Edit the Database

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 Fifteen, for this. The folder name will be 'twentyfifteen' 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.

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): http://example.com/
  • Structure: /%category%/%postname%

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

A blank page is also called the White Screen Of Death, and it's a PHP error. You can debug these by activating debug.

  1. Edit your wp-config.php file in your favorite editor.
  2. Find the line define( WP_DEBUG, false); and change false to true.

You should get an error now. If not, you'll have to go through the General Debugging steps at the top of the page.

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.