Tag Archives: Web Programming

WordPress Cron Can Kill a Website

I have run into this several times now so I thought I would write a quick article on it. It seems that WordPress’s cron really mess up a website.  Too many cron events will slow down your website. It can even cause timeout errors and out of memory issues.

What is cron?

Cron is basically a system to run programs in the background operation of your website. For a detailed explanation find out more here: Cron Info.

WordPress cron runs every time someone goes to your website. This is great as many plugin creators design software to do all kinds of fun and interesting things with your website. The downside is that these cron tasks can add up if not properly cleaned up. The average WordPress blog creator may not even know this exists. Worse, it can get full of all kinds of useless or out of data cron jobs.

The trouble is all these cron jobs are still queried, and possibly run, every time someone goes to your website. Over time this will certainly slow down your site. Especially if you experiment with many different plugins as many of them will leave residual cron tasks when they are uninstalled.

Check the WordPress Cron

First check your the WordPress cron and see if there is an unreasonable amount of cron jobs.

What’s unreasonable? That can vary greatly but I would say over 50 and you probably have too many. On my latest website with issues there were almost 20,000! Hard to say where they came from, but they needed to be cleared out!

First and foremost always backup your database when doing anything in it.

I prefer to go directly into the database with phpMyAdmin. Run the following SQL query.

This will retrieve the record of your cron jobs. In the option value field you will see something like this.

The only thing you really need to worry about is the very beginning of this entry. It will tell you how many cron jobs are present. In this case, there are 20.

In my case it looked like this.

19722! Yikes. This was pretty much crashing the website. Good news though. It is really easy to fix. Simply delete the cron entry and because of the magic and quality of WordPress the cron will be rebuilt the next time someone goes to your website. Easy as that!

Now you may need to go though and check your plugins, anything that schedules tasks, and verify that they are still scheduled and working. In most cases they will be. If not, set up the task again. These are things like calendars, auto backups, auto posts etc. All of these are done through cron jobs.

There is also a pretty cool plugin you can use to look at your cron jobs in a more UI friendly way.

https://wordpress.org/plugins/wp-crontrol/

Hopefully this helps you clean up and speed up your WordPress site!

VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

Remove Date from WordPress Permalink URLs for SEO with htaccess

When using WordPress for your website it will default to the standard URL format showing the page number. However, many of us have changed or initially set up our WordPress blogs using the dates in the URL’s such as imageinnovationsllc.com/2013/1/my-blog-post. Initially you might think that the date in the URL may be helpful for visitors to your website to help them know when an article was initially written. It may be helpful, but has been shown to actually hurt your website. Visitors might not have confidence in an older article, even if it is a great article and valid the day they visit it. Most importantly though, it clutters up your URL and ultimately will hinder your search engine rankings.

WordPress permalink setting allows bloggers to customize the structure of a URL. Doing so correctly will help your WordPress website to be search engine optimized, improve the aesthetics, usability, and forward-compatibility of navigation and links. Within WordPress’s Permalinks setting, WordPress presents a few common permalinks structure, of which at least two are date-based.

The data-based permalinks have the following URL structure:

Year/Month/Day/Post-Title: http://www.imageinnovationsllc.com/2013/02/20/sample-post/
Month/Day/Post-Title: http://www.imageinnovationsllc.com/2013/02/sample-post/

The date in URL unnecessary adds to the length of URL, can dissuade visitors, and hurt SEO. The best SEO practice is to strike off and remove the /yyyy/mm/dd or /yyyy/mm from the URL structure of the WordPress permalinks.

Here’s a quick tutorial on how to change the permalinks structure of your WordPress websites URLs with proper redirect in the .htaccess file. This will help your WordPress website to avoid 404 page not found errors and minimize the loss of traffic due to incoming out of date URL’s any links to your website. This will help your navigation, make your site more user friendly, improve your SERPs, and Google’s PageRank.

The URL’s of your WordPress premalinks will end up in this format: http://www.imageinnovationsllc.com/sample-post/ This should be the format that most WordPress websites or any other website should strive for. It is clear and concise and will help users and search engines better understand and use your website.

  1. First change the permalinks configuration in your Worpress. Go to the WordPress Dashboard of your website and navigate to Settings -> Permalinks.
  2. Select Post name in WordPress Permalink Settings..
  3. Select Save Changes in WordPress Permalink Settings.
  4. FTP or SSH into the web server which hosts the WordPress installation, and go to the directory where the .htaccess file is located for the site. This should be in the WordPress website root directory.
  5. Create a copy of the .htaccess file. Sample: .htaccess_backup
  6. Edit the .htaccess file directly. OR Download the .htaccess file and edit it locally. Then upload it when you are done.
  7. Edit the .htaccess with editor such as notepad, Wordpad, or any other text file editor.
  8. Add one of the two code blocks below depending on your old URL structure above the WordPress code in your .htaccess file.

For existing permalinks with /%year%/%monthnum%/%day%/%postname%/:

RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ /$4 [R=301,NC,L]

For existing permalinks with /%year%/%monthnum%/%postname%/:

RewriteEngine On
RewriteBase /
RewriteRule ^([0-9]+)/([0-9]+)/(.*)$ /$3 [R=301,NC,L]

  1. Save the WordPress .htaccess file.
  2. Immediately test your WordPress website. Any error in the code can easily shut down your site with server errors. Access your WordPress website to be sure it is still functional. If it is not. Replace the edited .htaccess file with your backup or change the file back to how it was. Then try to enter the code again.
  3. With your WordPress website working enter a few links with the old URL structure to test that the redirection is working properly.

You may want to utilize MySQL replace function to replace the links with old permalink structure in posts, pages and comments to new URLs directly in database, much like what is been done when moving WordPress to new domain or location. Useful when you have thousands of articles which make manual changing impossible.

You can easily track problem URL’s with Google Webmaster Tools. This is an invaluable to keep track of the health of your site and to discover and correct issues that may be hurting your SEO and Google rankings.

VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

DDM’s Realm Game Database

http://www.ddmsrealm.com/index.php/dungeons-and-dragons-quest-and-magic-item-database

This is one of the hobby sites that I run. This website is dedicated to the Massively Multi-player Online Role-playing game (MMORPG) Dungeons and Dragons Online.

Since games are one of my passions I decided to build a database of all the items and quests within Dungeons and Dragons Online. Thus gives players the ability to search for and find related quests and items. DDM’s Realm has turned into a very popular site for the game.

I strive to keep DDM’s Realm the most complete source of information available on the Internet. It pulls data from other sites and sources and is kept up-to-date by manual verification of game data.

ddmsrealm.com/ddoddmsrealm.com/ddoddmsrealm.com/ddo

 

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)