Difference between revisions of "WordPress"
(→How to Update WordPress) |
|||
Line 3: | Line 3: | ||
==What is WordPress?== | ==What is WordPress?== | ||
WordPress is an open source CMS, often used as a blog publishing application powered by PHP and MySQL. | WordPress is an open source CMS, often used as a blog publishing application powered by PHP and MySQL. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 161: | Line 146: | ||
[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: | + | [[Category:WordPress]] |
Revision as of 05:18, 16 February 2017
Contents
- 1 What is WordPress?
- 2 How to Protect WordPress
- 3 Changing Domain Name on a Wordpress Site
- 4 Error Establishing Database Connection
- 5 Wordpress Slowness Troubleshooting
- 6 Plugin and Theme Problems
- 7 URL Redirects / Permalink Troubleshooting
- 8 How to modify your PHP Settings
- 9 WordPress - Video Tutorials
What is WordPress?
WordPress is an open source CMS, often used as a blog publishing application powered by PHP and MySQL.
How to Protect WordPress
Windows Server
- Edit or Create a file named .htaccess within the directory of your WordPress installation (yes, the file starts with .)
- Place this code in the .htaccess file (this example assumes your IP is 123.123.123.123). Click to see your IP.
RewriteEngine On RewriteCond %{REQUEST_URI} ^(.*)?xmlrpc\.php(.*)$ [OR] RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR] RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$ RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$ RewriteRule .* http://0.0.0.0/Please_check_your_htaccess_file_or_contact_your_hosting_provider_for_assistance [R=301]
NOTE: If you need to allow access from more than 1 IP replace the REMOTE_ADDR line with this example and update accordingly
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$
Linux Server
- Edit or Create a file named .htaccess within the directory of your WordPress installation (yes, the file starts with .)
- Place this code in the .htaccess file (this example assumes your IP is 123.123.123.123). Click to see your IP.
<FilesMatch 'wp-login|admin-ajax.php|wp-admin'> RewriteEngine On RewriteCond %{REMOTE_ADDR} !123.3123.123.123 RewriteRule .* http://0.0.0.0/Please_check_your_htaccess_file_or_contact_your_hosting_provider_for_assistance [R=301] </FilesMatch>
NOTE: If you need to allow access from more than 1 IP replace the REMOTE_ADDR line with this example and update accordingly
RewriteCond %{REMOTE_ADDR} !123.123.123.123
Changing Domain Name on a Wordpress Site
- Update Wordpress and all of your themes and plugins.
- Backup site files.
- Backup your database.
- Login to phpMyAdmin.
- 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.
- All the tables in your database will appear on the screen.
- From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
- Click on the small icon indicated as Browse.
- A screen will open with a list of the fields within the wp_options table.
- Under the field option_name, scroll down and look for siteurl.
- Click the Edit Field icon which usually is found at the far left at the beginning of the row.
- The Edit Field window will appear.
- In the input box for option_value, carefully change the URL information to the new address.
- Verify this is correct and click Go to save the information.
- You should be returned to your wp-options table.
- 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.
- In the input box for option_value, carefully change the URL information to the new address.
- 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).
- After following the steps above, login into your WordPress admin and change the domain name at the following places:
- 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 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. http://yourdomain.com/cpanel)
- 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
How to manage categories in WordPress
How to write a comment in WordPress
How to change your header in 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