Difference between revisions of "WordPress"

From Hostek.com Wiki
Jump to: navigation, search
m
m (What is WordPress?)
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
__FORCETOC__
 
__FORCETOC__
 
==What is WordPress?==
 
WordPress is an open source CMS, often used as a blog publishing application powered by PHP and MySQL.
 
 
==How to Update WordPress==
 
[http://hostek.com/tutorials/wp-upgrade.html How to update your WordPress installation]
 
  
 
==Changing Domain Name on a Wordpress Site==
 
==Changing Domain Name on a Wordpress Site==
The first step is to change the domain name in the MySQL database that your WordPress is using. If your not sure what database its using check the main "wp-config.php" file. It will have your MySQL host, database name, and the database username/password. <br>
+
# Update Wordpress and all of your themes and plugins.
 +
# Backup site files.
 
# Backup your database.
 
# Backup your database.
 
# Login to phpMyAdmin.
 
# Login to phpMyAdmin.
# Click the link to your Database.
+
# Click the link to your Database (If your not sure what database its using check the main "wp-config.php" file. It will have your MySQL host, database name, and the database username/password).
 
# A list of your databases will appear. Choose the one that is your WordPress database.
 
# A list of your databases will appear. Choose the one that is your WordPress database.
 
# All the tables in your database will appear on the screen.
 
# All the tables in your database will appear on the screen.
Line 27: Line 22:
 
# Verify this is correct and click Go to save the information.
 
# Verify this is correct and click Go to save the information.
 
# Now, via your FTP for the site, Delete the folder wp-content/cache (this is a new folder added with WordPress 2.0).
 
# Now, via your FTP for the site, Delete the folder wp-content/cache (this is a new folder added with WordPress 2.0).
<br>
+
# After following the steps above, login into your WordPress admin and change the domain name at the following places:
After you change the domain name in the database, then you can login into your WordPress admin and change it at the following places:
+
## Settings - General - Update the "WordPress address (URL)" and the "Blog address (URL):" if filled.
<br>
+
## Settings - Misc. - Update the domain name in the "Store uploads in this folder" path, if it has the olddomain.
# Settings - General - Update the "WordPress address (URL)" and the "Blog address (URL):" if filled.
+
 
#Settings - Misc. - Update the domain name in the "Store uploads in this folder" path, if it has the olddomain.
+
==Error Establishing Database Connection==
 +
This error means wordpress cannot connect to the database but can have any number of causes.
 +
#If this is a site transfer, ensure the wp-config.php file has the correct database name and database user for your new Hostek site.
 +
#First check to see if your wp-admin section gets the same error. When you browse to http://yourdomain.com/wp-admin, if it has any other error (or none at all) add the following line to your wp-config.php file:
 +
define('WP_ALLOW_REPAIR', true);
 +
and visit http://yourdomain.com/wp-admin/maint/repair.php and you can repair the database. Remove the added code from wp-config.php when you are done.
 +
#DB_HOST will be set differently depending on what server your site is on. In wp-config.php, confirm that your 'DB_HOST', line has either localhost (for shared Linux/CPanel servers and VPSs) or an IP Address that corresponds to the database's hosted server (you can find this in your control panel). If you are supposed to use localhost but still get the error, try replacing it with '127.0.0.1' which may sometimes solve the issue.
 +
#Test general connections to the MySQL server which hosts the database. Make a blank php file somewhere on your site called dbconnecttest.php and use the following code:
 +
<?php
 +
$link = mysql_connect('localhost', 'root', 'password');
 +
if (!$link) {
 +
die('Could not connect: ' . mysql_error());
 +
}
 +
echo 'Connected successfully';
 +
mysql_close($link);
 +
?>
 +
(Replace the 'localhost', 'root', and 'password' sections with the appropriate host, username, and password.)
 +
#If you still get the same error, the user may have insufficient permission or the database can't be reached at all, in which case please create a support ticket at http://support.hostek.com with the problem and troubleshooting you've gone through. You can also try connecting to the database with PHPMyadmin and if the user doesn't have permissions, it will show a corresponding error.
 +
#There may be some junk data in the database that a repair won't fix. Commonly the tables "active_plugins" and "recently_edited" can contain extra non-used information from switching between themes and plugins that cause the site to stop connecting to the database. Go to your PHPMyadmin, find the wordpress database, then find those two tables. Remove the contents for the two tables specified that have nothing to do with your site (for example, do not remove information related to your theme).
 +
#If the site is relatively small or new and you're willing to start over, downloading the latest version of Wordpress and installing it or using our Wordpress installer from the application menu (Windows servers), and Fantastico (CPanel/Linux).
 +
#Try changing the user's password for the database (be sure to update this in wp-config.php). Sometimes MySQL or something else has an update which can change password formatting compatability.
 +
 
 +
==Wordpress Slowness Troubleshooting==
 +
Site slowness can be a common problem that has causes ranging anywhere from too many requests, large file size requests, poor DNS mapping, or server slowness.
 +
#First check your site on http://tools.pingdom.com which should come up with a lot of information. Verify that the site's load time is high there as well for you. If it's low for pingdom, you more than likely are having an issue with your local internet connection speed or proxy. If your local speed is fast, it could also be the amount of client-side coding on the site (such as JavaScript). Consider switching most elements to server-side coding such as PHP, Coldfusion, Ruby, or ASP.
 +
#As the page size increases, the time it takes to fulfill a request goes up. Larger files can hang and time out, so be sure to reduce image filesizes and check the amount of media on a site.
 +
#Check to make sure none of the listed files are red. If they are, they are missing and could be causing the browser to wait for it for an unnecessarily long time, especially if the file is integral.
 +
#As the number of requests increase, the time also increases. Requests are handled in concurrent chunks. Different browsers can handle a different maximum number (usually 2-8, but sometimes 15+). The more requests your page makes to JS files, CSS files, images, and so forth, the more time it will take depending on the browser and server's limitations for concurrent requests. Even if they are all extremely small file sizes, consider reducing these by combining external CSS files and JS files, and combining smaller images into "sprites" which load that image once, but display different parts of it in different places (More information: http://css-tricks.com/css-sprites/  and http://spriteme.org/faq.php#def ).
 +
#Any external requests (to other hosts) will increase response time as this will be dependent on that host, as well as your browser's settings. Limit the number of external image and code loading.
 +
#Complicated DNS entries can cause slowness. Since DNS begins a request, it has to go through the route set out for it ahead of time. If that route involves multiple other services such as Google API, Cloudflare, Dropbox, or Microsoft Office 365, you may experience additional load time.
 +
#SSL can slightly slow down a site, and loading external elements which authenticate over SSL (such as paypal or donate buttons) will cause some level of slowdown due to the secure "handshake" that must occur.
 +
#Redirects listed will increase load time. These can be due to DNS records or just due to redirection performed in site code.
 +
#If you have lots of requests, the initial DNS resolve time can be improved by having your domain Registrar be the same as your website host. For example, at Hostek we use our own DNS clusters; when you have both your domain and web site hosted through us, there will be a slight speed difference than if your Registrar has to point to our servers from a remote location.
 +
#A CMS such as Wordpress, generally come in much more resource-intensive packages. Try ensuring your plugins are reduced to a minimum and that themes are not too overly complicated. If you have already optimized your site or require a more elaborate site, consider making a support ticket at http://support.hostek.com to inquire about what other packages we may have available to speed up your performance. If you have a VPS, check to see if the site is taking up a lot of resources and consider ordering more processing power or memory if necessary.
 +
 
 +
==Plugin and Theme Problems==
 +
When your Wordpress site is not working or is performing poorly, themes and plugins are the best first investigation point as they tend to cause most of the issues.
 +
#If you can log into your wp-admin, disable some plugins one by one and check the site each time. Alternatively, disable all of the plugins and check to see if this fixes the issue. If it does, re-enable plugins individually until you find the culprit.
 +
#Always keep plugins and Wordpress up to date with the latest version. Even if it breaks some usability, you will be more secure and less likely to have larger problems overall. Updates mostly include critical bug fixes, compatibility changes and security updates.
 +
#If you cannot even log into your wp-admin section, open either an FTP client or your file manager from the control panel and simply find the folder "/wp-content/plugins" and rename "plugins" to something else. Try logging into your wp-admin and check to see if this solved the problem. If it did, rename the folder back and then rename each plugin except for one. Continue restoring their names until you find the culprit.
 +
#Sometimes plugins or themes are simply incompatible with each other due to third party development being so open. If you find conflicting plugins (that work fine separately but not together), consider changing one of the plugins to another one that suits the same purpose.
 +
#Make a backup copy of your site by zipping it or moving it into another folder. Now try switching themes and check to see that the problem is gone. If the problem is gone, try either a new theme or get with your developer on fixing the compatibility with the current theme if it is needed. Restore the backup of the site when done.
 +
 
 +
==URL Redirects / Permalink Troubleshooting==
 +
Sometimes site pages do not load (even when they may have done so before).
 +
#Check the links themselves by hovering over them to make sure the path is correct. If anything is present shouldn't be or missing, then you will have a better idea of what may be happening.
 +
#Check .htaccess to be sure there are no redirects occurring that have broken this. This can be as simple as improper syntax (use a syntax checker: http://htaccess.madewithlove.be/ ) or making sure the redirects and rewrites are operating the way they were intended. If your Wordpress is on Windows, be sure that your .htaccess is using proper ISAPI compatible rewrites.
 +
#Check Wordpress permalinks by going into wp-admin and looking for the site settings and then permalinks. Once there, you can troubleshoot the issue by saving any custom permalink format you may be using and checking the Default (first) option to see if this resolves the issue. If the issue is resolved, revise the permalink format or consider one of the pre-made options.
 +
 
 +
==How to modify your PHP Settings==
 +
 
 +
===Windows/WCP Plans===
 +
*Please refer to our separate wiki [https://wiki.hostek.com/WCP_(Windows_based_Control_Panel)#PHP_Settings here]
 +
 
 +
===Linux/cPanel Plans===
 +
*This is a very useful tool when it comes to making specific changes to PHP. Instead of using a "php.ini" file it will change it directly on the server for your Domain.
 +
#Login to cPanel (e.g. <nowiki>http://yourdomain.com/cpanel</nowiki>)
 +
#Under the "Software and Services" section, go to '''PHP Settings'''
 +
#*If you don't see the '''PHP Settings''' button, you'll want to follow these steps:
 +
##Click on '''Select PHP Version'''
 +
##Click on '''Switch to PHP Settings''' -- This is located on the upper-right hand side of the page.
 +
#Start modifying any of the values here by clicking on them.
 +
#Click Save
  
 
 
==WordPress - Video Tutorials==
 
==WordPress - Video Tutorials==
 
[http://hostek.com/tutorials/wp-categories.html How to manage categories in WordPress]
 
[http://hostek.com/tutorials/wp-categories.html How to manage categories in WordPress]
Line 59: Line 115:
 
[http://hostek.com/tutorials/wp-upgrade.html How to update your WordPress installation]
 
[http://hostek.com/tutorials/wp-upgrade.html How to update your WordPress installation]
  
[[Category:Tutorials]]
+
[[Category:WordPress]]

Latest revision as of 20:38, 19 February 2017


Changing Domain Name on a Wordpress Site

  1. Update Wordpress and all of your themes and plugins.
  2. Backup site files.
  3. Backup your database.
  4. Login to phpMyAdmin.
  5. Click the link to your Database (If your not sure what database its using check the main "wp-config.php" file. It will have your MySQL host, database name, and the database username/password).
  6. A list of your databases will appear. Choose the one that is your WordPress database.
  7. All the tables in your database will appear on the screen.
  8. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
  9. Click on the small icon indicated as Browse.
  10. A screen will open with a list of the fields within the wp_options table.
  11. Under the field option_name, scroll down and look for siteurl.
  12. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  13. The Edit Field window will appear.
  14. In the input box for option_value, carefully change the URL information to the new address.
  15. Verify this is correct and click Go to save the information.
  16. You should be returned to your wp-options table.
  17. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
  18. In the input box for option_value, carefully change the URL information to the new address.
  19. Verify this is correct and click Go to save the information.
  20. Now, via your FTP for the site, Delete the folder wp-content/cache (this is a new folder added with WordPress 2.0).
  21. After following the steps above, login into your WordPress admin and change the domain name at the following places:
    1. Settings - General - Update the "WordPress address (URL)" and the "Blog address (URL):" if filled.
    2. Settings - Misc. - Update the domain name in the "Store uploads in this folder" path, if it has the olddomain.

Error Establishing Database Connection

This error means wordpress cannot connect to the database but can have any number of causes.

  1. If this is a site transfer, ensure the wp-config.php file has the correct database name and database user for your new Hostek site.
  2. First check to see if your wp-admin section gets the same error. When you browse to http://yourdomain.com/wp-admin, if it has any other error (or none at all) add the following line to your wp-config.php file:
define('WP_ALLOW_REPAIR', true);

and visit http://yourdomain.com/wp-admin/maint/repair.php and you can repair the database. Remove the added code from wp-config.php when you are done.

  1. DB_HOST will be set differently depending on what server your site is on. In wp-config.php, confirm that your 'DB_HOST', line has either localhost (for shared Linux/CPanel servers and VPSs) or an IP Address that corresponds to the database's hosted server (you can find this in your control panel). If you are supposed to use localhost but still get the error, try replacing it with '127.0.0.1' which may sometimes solve the issue.
  2. Test general connections to the MySQL server which hosts the database. Make a blank php file somewhere on your site called dbconnecttest.php and use the following code:
<?php
$link = mysql_connect('localhost', 'root', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

(Replace the 'localhost', 'root', and 'password' sections with the appropriate host, username, and password.)

  1. If you still get the same error, the user may have insufficient permission or the database can't be reached at all, in which case please create a support ticket at http://support.hostek.com with the problem and troubleshooting you've gone through. You can also try connecting to the database with PHPMyadmin and if the user doesn't have permissions, it will show a corresponding error.
  2. There may be some junk data in the database that a repair won't fix. Commonly the tables "active_plugins" and "recently_edited" can contain extra non-used information from switching between themes and plugins that cause the site to stop connecting to the database. Go to your PHPMyadmin, find the wordpress database, then find those two tables. Remove the contents for the two tables specified that have nothing to do with your site (for example, do not remove information related to your theme).
  3. If the site is relatively small or new and you're willing to start over, downloading the latest version of Wordpress and installing it or using our Wordpress installer from the application menu (Windows servers), and Fantastico (CPanel/Linux).
  4. Try changing the user's password for the database (be sure to update this in wp-config.php). Sometimes MySQL or something else has an update which can change password formatting compatability.

Wordpress Slowness Troubleshooting

Site slowness can be a common problem that has causes ranging anywhere from too many requests, large file size requests, poor DNS mapping, or server slowness.

  1. First check your site on http://tools.pingdom.com which should come up with a lot of information. Verify that the site's load time is high there as well for you. If it's low for pingdom, you more than likely are having an issue with your local internet connection speed or proxy. If your local speed is fast, it could also be the amount of client-side coding on the site (such as JavaScript). Consider switching most elements to server-side coding such as PHP, Coldfusion, Ruby, or ASP.
  2. As the page size increases, the time it takes to fulfill a request goes up. Larger files can hang and time out, so be sure to reduce image filesizes and check the amount of media on a site.
  3. Check to make sure none of the listed files are red. If they are, they are missing and could be causing the browser to wait for it for an unnecessarily long time, especially if the file is integral.
  4. As the number of requests increase, the time also increases. Requests are handled in concurrent chunks. Different browsers can handle a different maximum number (usually 2-8, but sometimes 15+). The more requests your page makes to JS files, CSS files, images, and so forth, the more time it will take depending on the browser and server's limitations for concurrent requests. Even if they are all extremely small file sizes, consider reducing these by combining external CSS files and JS files, and combining smaller images into "sprites" which load that image once, but display different parts of it in different places (More information: http://css-tricks.com/css-sprites/ and http://spriteme.org/faq.php#def ).
  5. Any external requests (to other hosts) will increase response time as this will be dependent on that host, as well as your browser's settings. Limit the number of external image and code loading.
  6. Complicated DNS entries can cause slowness. Since DNS begins a request, it has to go through the route set out for it ahead of time. If that route involves multiple other services such as Google API, Cloudflare, Dropbox, or Microsoft Office 365, you may experience additional load time.
  7. SSL can slightly slow down a site, and loading external elements which authenticate over SSL (such as paypal or donate buttons) will cause some level of slowdown due to the secure "handshake" that must occur.
  8. Redirects listed will increase load time. These can be due to DNS records or just due to redirection performed in site code.
  9. If you have lots of requests, the initial DNS resolve time can be improved by having your domain Registrar be the same as your website host. For example, at Hostek we use our own DNS clusters; when you have both your domain and web site hosted through us, there will be a slight speed difference than if your Registrar has to point to our servers from a remote location.
  10. A CMS such as Wordpress, generally come in much more resource-intensive packages. Try ensuring your plugins are reduced to a minimum and that themes are not too overly complicated. If you have already optimized your site or require a more elaborate site, consider making a support ticket at http://support.hostek.com to inquire about what other packages we may have available to speed up your performance. If you have a VPS, check to see if the site is taking up a lot of resources and consider ordering more processing power or memory if necessary.

Plugin and Theme Problems

When your Wordpress site is not working or is performing poorly, themes and plugins are the best first investigation point as they tend to cause most of the issues.

  1. If you can log into your wp-admin, disable some plugins one by one and check the site each time. Alternatively, disable all of the plugins and check to see if this fixes the issue. If it does, re-enable plugins individually until you find the culprit.
  2. Always keep plugins and Wordpress up to date with the latest version. Even if it breaks some usability, you will be more secure and less likely to have larger problems overall. Updates mostly include critical bug fixes, compatibility changes and security updates.
  3. If you cannot even log into your wp-admin section, open either an FTP client or your file manager from the control panel and simply find the folder "/wp-content/plugins" and rename "plugins" to something else. Try logging into your wp-admin and check to see if this solved the problem. If it did, rename the folder back and then rename each plugin except for one. Continue restoring their names until you find the culprit.
  4. Sometimes plugins or themes are simply incompatible with each other due to third party development being so open. If you find conflicting plugins (that work fine separately but not together), consider changing one of the plugins to another one that suits the same purpose.
  5. Make a backup copy of your site by zipping it or moving it into another folder. Now try switching themes and check to see that the problem is gone. If the problem is gone, try either a new theme or get with your developer on fixing the compatibility with the current theme if it is needed. Restore the backup of the site when done.

URL Redirects / Permalink Troubleshooting

Sometimes site pages do not load (even when they may have done so before).

  1. Check the links themselves by hovering over them to make sure the path is correct. If anything is present shouldn't be or missing, then you will have a better idea of what may be happening.
  2. Check .htaccess to be sure there are no redirects occurring that have broken this. This can be as simple as improper syntax (use a syntax checker: http://htaccess.madewithlove.be/ ) or making sure the redirects and rewrites are operating the way they were intended. If your Wordpress is on Windows, be sure that your .htaccess is using proper ISAPI compatible rewrites.
  3. Check Wordpress permalinks by going into wp-admin and looking for the site settings and then permalinks. Once there, you can troubleshoot the issue by saving any custom permalink format you may be using and checking the Default (first) option to see if this resolves the issue. If the issue is resolved, revise the permalink format or consider one of the pre-made options.

How to modify your PHP Settings

Windows/WCP Plans

  • Please refer to our separate wiki here

Linux/cPanel Plans

  • This is a very useful tool when it comes to making specific changes to PHP. Instead of using a "php.ini" file it will change it directly on the server for your Domain.
  1. Login to cPanel (e.g. http://yourdomain.com/cpanel)
  2. Under the "Software and Services" section, go to PHP Settings
    • If you don't see the PHP Settings button, you'll want to follow these steps:
    1. Click on Select PHP Version
    2. Click on Switch to PHP Settings -- This is located on the upper-right hand side of the page.
  3. Start modifying any of the values here by clicking on them.
  4. Click Save

WordPress - Video Tutorials

How to manage categories in WordPress

How to write a comment in WordPress

How to change your header in WordPress

How to install WordPress

How to manage pages in WordPress

How to change your password in WordPress

How to manage users in WordPress

How to manage your plugins in WordPress

How to write a new post in WordPress

How to edit your profile in WordPress

How to configure your settings in WordPress

How to update your WordPress installation