BAC Software Consulting Blog

How to Delete and Limit Post Revisions in WordPress

WordPress 2.6 and above has a new feature which is the posts and page revision. WordPress automatically creates revisions of your posts or pages. Whenever you save a post or a page, the old version is retained so you can revert back at any time. Older revisions are never deleted so you always have a full history of all changes. However, this feature causes your WP database to rapidly increase in size. Depending how active your blog is, revisions can seriously bloat your database with multiple copies of the same post. Each additional revision will slowly increase the size of your MySQL database.

Sometime it is necessary to do some cleanup. Every revision requires a separate record in wp_posts table and probably entries in the wp_term_taxonomy, wp_postmeta and wp_term_relationships tables. Removing older revisions will free up disk space.

Too many revisions stored in the database might cause longer query time. This means that your blog will load slower and your visitors may wait longer before the content loads. This also leads to high CPU or memory load on your Web hosting server. To my shock, I realized that in this blog I have anywhere from 9 to 47 unnecessary revisions per post/page. Wow!

Does reducing the database size, also speeds up your Website load time?

As you can see from the above image, removing old revisions is one of the best things you can do to your WordPress blog to keep it running efficiently. For a personal blog, many versions of the same post is a waste of resources. Excessive revisions will increase the burden on the database, slows down your WP admin area, your phpMyAdmin and may slow down the download time of your WP Website.

WP Revision Options

The WP_POST_REVISIONS constant has 3 options.

  1. true (default), -1: store every revision
  2. false, 0: do not store any revisions (except one for auto save)
  3. (int) > 0: store that many revisions (+1 auto save). Old revisions are automatically deleted.

Deleting Existing Revisions Using SQL command

Before we start, I am going to say this once: BACK UP YOUR DATABASE. You are about to run SQL statements to your WP database, and if you make a mistake you can revert back to your backup version.

To permanently delete all existing revisions for all pages and posts, login to your phpMyAdmin, select your WordPress database, click on the “SQL” button and paste the following code in the SQL command window. For a detailed explanation about SQL command1, the tutorial is in the References section at the end of this post.

SQL command1:

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id )
LEFT JOIN wp_term_taxonomy d ON ( b.term_taxonomy_id = d.term_taxonomy_id)
WHERE a.post_type = 'revision'
AND d.taxonomy != 'link_category';

My WP Database After Executing SQL command1

After executing SQL command1I noticed that NOT all stored revisions are deleted in the my WP database. Checking the post_type field in the wp_posts table, I noticed that there are still many “history” data that have not been removed. It seems that the above code still leaves some traces behind. This brings me to the execution of the next SQL command2.

To better explain, the wp_posts table has a field named post_type. This field can have many values, such as post, page or revision. When we want to get rid of all revisions, we run a SQL command to delete any entry in the wp_posts table in which the post_type field is equal to revision.

Again, in your phpMyAdmin area, click on the “SQL” button, and paste the following code in the SQL command window, and hit Go.

SQL command2:

DELETE FROM wp_posts WHERE post_type = 'revision';

My WP Database After Executing SQL command2

Now after executing SQL command2, all previously saved revisions stored in the WP database are totally removed. There are no orphaned data left in the database.

The following table shows my WP database before and after executing SQL command1 and then SQL command2.

 table: wp_posts
(Records)
table: wp_postmeta
(Records)
table: wp_term_relationships
(Records)
Database size
(KB)
Database reduced by:
(Compared to Baseline)
Baseline
(Before Executing the SQL commands)
7892154947,558n/a
After Executing SQL command14162151214,99333.93%
After Executing SQL command24421512150993.26%

Wow! After executing SQL command1 and then SQL command2, the size of the database has been reduced by 93.26%, and the wp_posts table has now 44 records down from 789 records originally. That would tell you how much the WP revision feature can accumulate unnecessary records in the database. Now the question that comes to mind is how to prevent or at least limit the number of revisions in WordPress?

Disable or Limit Revision feature in WordPress

To Disable WordPress Post Revisions:

You can turn off post/page revision feature by editing your wp-config.php file located in your WordPress root directory. Simply add the following code at the top of the wp-config.php file:

//Turn OFF WP revisions feature. 
define('WP_POST_REVISIONS', false);

You could put the code above anywhere at the beginning of the config file as long as it is inside the opening PHP tag (<?php)

To Limit WordPress Post Revisions:

Alternatively, you can use a positive integer to limit the number of revisions.

//Limit WP revisions. Value can be any positive integer number.
//Create a maximum of 2 revisions, plus one for auto-save.
define('WP_POST_REVISIONS', 2);

What About Website Loading Speed?

After the size of the database has been significantly reduced (93% in my case), I noticed that:

  1. WordPress administration area is faster to load and to respond to user requests.
  2. phpMyAdmin area, where the WP database reside, is faster to respond to user requests.

But the biggest question I have: Did deleting WordPress post and page revisions have any impact on this Blog loading speed?

Does Deleting Post and Page Revisions Speed up Your WordPress Website?

I would say that the improvement of this blog´s download time is statistically insignificant. What remains to be seen is that if you have a much larger database with hundreds of posts, would that make a significant difference?

DoFollow Versus NoFollow What to Choose for Your Website?

DoFollow and NoFollow are important factors for SEO that influence the ranking of a particular Website in search engines. DoFollow is a term that does not exist. It is a term given to Websites that are not using the rel=“nofollow” attribute in links. nofollow is a value that can be assigned to the rel attribute of the HTML link to instruct some search engines not to pass on any influence to an outbound link. NoFollow and DoFollow control how a Website passes its PageRank or link juice to other links.

Although search engines don´t pass along the link juice (or let PageRank flow) they still follow and index these links. The nofollow value is not meant for preventing content from being indexed by search engines.

What Exactly is NoFollow?

NoFollow (rel=“nofollow”) means that PageRank or Link juice will NOT be passed to a link. It tells major Search Engines, especially Googlebot, that this link can be followed, the linked page is crawled and indexed, but the PageRank score will not be taken into account.

The attribute that defines a link as NoFollow is rel=“nofollow”.

A typical NoFollow link is like this:

<a rel="nofollow" href="https://bacsoftwareconsulting.com/" title="">BAC</a>

What Exactly is DoFollow?

DoFollow is the exact opposite of NoFollow. A DoFollow link will let your PageRank flow to all external and internal links. When you remove the rel=“nofollow” attribute from a link, then the link becomes DoFollow. The absence of the nofollow value makes the link a DoFollow. Search Engines robots, especially Googlebot, will crawl the link, index it and the PageRank score will be taken into account.

A typical DoFollow link is like this:

<a href="https://bacsoftwareconsulting.com/" title="">BAC</a>

How Do I Know if a Website is Using NoFollow?

There are 2 ways to check:

  1. View the Source code: Highlight the link that you want to check and view the source code of the Webpage. There are several ways to To view the page source depending on the browser you use. You could either select “source” from your browser´s menu or you could right click on the page to view the source from the context menu.
  2. Use an Add-On: Mozilla Firefox and Google Chrome browsers have add-ons that highlight a NoFollow link on a Webpage without actually looking at the source code.

Advantages of rel=“nofollow” Attribute

  1. Minimize Comment Spam: Especially the comment spam that is manually filled by real users once they know that your Website is DoFollow. Automatic spam will not be affected. Robots that submit spam will not check your link status.
  2. Not Passing on Your PageRank:You might not want to pass your PageRank to Websites that are completely unrelated to your field, as this, with time, may cause your PageRank score to go down.
  3. The overall PageRank of your Website is preserved.

Disadvantages of rel=“nofollow” Attribute

  1. You will not attract more visitors to comment on your Website, thus getting less traffic.
  2. Without improving popularity, you may not get inbound links to your Website. Thus your PageRank will not improve.
  3. Less traffic, means less clicks to any advertisements you have on your Website, and thus less earnings.

Where Should I use rel=“nofollow” Attribute

Use the rel=“nofollow” attribute whenever you don´t want to pass your link juice. Regardless what you read otherwise, never add nofollow to any internal pages of your Website. Here are some scenarios when to use NoFollow:

  1. Use NoFollow for single pages that has more than 100 links. For example, a resource page having several hundred links.
  2. Use NoFollow for Trust Badges: like the Better Business Bureau and VeriSign, you can add rel=“nofollow” to those links.
  3. Use NoFollow for your RSS feed. This ensures that your RSS feed isn´t indexed before your Website.
  4. Use NoFollow when linking to any “questionable” and untrusted Websites.
  5. Use NoFollow for mega Websites and Social Networks such as: Facebook, Gmail, Adsense, etc.
  6. Use NoFollow if you link to Web browsers such as Mozilla and Chrome.
  7. Use NoFollow for paid advertising. If you sell advertisement space on your Website, those ads should always have a rel=“nofollow” attribute inserted in the Link.
  8. Use NoFollow for affiliate links.

Is NoFollow a Bad Thing?

No not necessarily, consider the following: The NoFollow links might have no effect on PageRank but they still refer real people. As long as “real visitors” can follow the links, that´s great. Eventhough you do not get link juice from the NoFollow links, you still get real visitors.

NoFollow isn´t bad. There´s nothing wrong with getting NoFollow links. While they don´t pass link juice, they do help associate your Website with anchor text.

Advantages of DoFollow

The advantages of adding DoFollow links on your Website are:

  1. You will attract more visitors especially for comments, thus getting more traffic, exposure and popularity.
  2. With an increase in popularity, you may get more inbound links to your Website, which helps your PageRank to increase.
  3. The increase in traffic may also increase your revenue from affiliate programs and other advertisements.

Disadvantages of DoFollow

  1. The PageRank of your Webpage will be passed to external links. The overall PageRank can be reduced.
  2. However, you can offset the decrease of your PageRank by attracting more inbound links.
  3. You get an increase of spam Comments, which require extra time and efforts from your side.

Which Links Should be Set as DoFollow?

To reemphasize, the non-existence of the rel=“nofollow” attribute, means that the link is DoFollow. Links that should be kept DoFollow are:

  1. All Internal Links. Internal links will help spiders crawl your pages more deeply and they will get indexed often.
  2. For a blog, links pointing to posts should be kept DoFollow.
  3. Niche links can be DoFollow. Always give a link to a Website that shares the same content as yours.

Why Blog Owners Abandon DoFollow?

The answer is simple Comment spam. Spam does not have to be automated. A person can leave just as many worthless comments as software just to get link juice. For every person who takes the time to make a genuine comment, there are several who do the following:

  1. Leave a trivial comment.
  2. Leave a short summary of the Post.
  3. Leave a flat out spam comment unrelated to the topic.
  4. Leave spam comments on several posts in one session.

Conclusion

  1. Ultimately, as long you keep providing great content and services that people want, your Website will grow.
  2. Whatever your decision is, just remember that one “authoritative” link can be more effective than several low level links.
  3. You can build relationships through commenting. Leaving thoughtful comments is a good way to start a relationship with an influential blogger in your field.
  4. Remember that DoFollow blogs are giving you link juice in exchange for your quality comments. So, be considerate. If you post junk comments, blog owners will get tired of moderating and taken advantage of, and will eventually turn NoFollow back on.

So What would I choose? The best approach is to use a mixture of DoFollow AND NoFollow links.

A Closer Look At HTML Versions

HTML has evolved into one of the most used and highly recommended markup languages. Web developers, both amateurs as well as professionals have tremendously benefited from the emergence of HTML. The frequent release of different HTML versions reflects the growing popularity of the language. Through this post, I will be familiarizing you with different versions of HTML which have created a wave in the world of web development. So, let’s examine each of these HTML versions closely.

1. First Version – HTML

Well, the very first version of HTML didn’t come with a number. IT was just called “HTML” and was solely used for creating simple web pages. Marking its use way back in 1989-1995, this first version of HTML was later standardized by IETF and numbered as “HTML 2.0”(explained under point no.2 below).

2. Second Version – HTML 2.0

Considered as the very first definitive HTML version, the initial draft of HTML 2.0 was being re-written and revamped by Karen Muldrow in July 1994. After this, it was being presented at an IETF meeting in Toronto. The sole purpose of this draft was to capture the most common HTML practice in web browsers. Some of the features absent in HTML 2.0 include: support for tables or ALIGN attributes, Netscape/Microsoft extensions etc.

3. Third version – HTML 3

Released back in late 1995, HTML 3 was a result of the tireless efforts put in by Dave Raggett who was inclined on upgrading the features and utility of HTML. Although this version was never implemented, a majority of its features were being integrated in HTML’s next official version which was known as HTML 3.2.

Version 3.2 of HTML came equipped with an integrated support for images, Tables, heading and a variety of element ALIGN attributes. Serving as the current “universal” dialect, HTML 3.2 could be understood by all the major browsers. However, some features which went missing in HTML 3.2 comprised of EMBED, FRAMES and APPLET. This HTML version was being presented by World Wide Web Consortium (W3C) in the year 1997. Published in January 1997, HTML 3.2 included attribute alignment, tables, headings, images and a lot more.

4. Fourth Version – HTML 4.0

Considered as the next major release of HTML, version 4.0 was introduced in December 1997. As an extension to its existing feature set comprising of multimedia, text and hyperlink, this version of HTML included advanced multimedia options, style sheets, scripting languages, improved printing facilities and documents, which are accessible to users with specific disabilities. This version of HTML has also taken stride towards the internationalization of documents, with the sole aim of ensuring maximum evolution of the World Wide Web.

HTML 4.01

Yet considered as another official release of HTML, the version 4.01 includes support for a majority of extensions in addition to features such as extra TABLE, JavaScript enhancements, support for internationalized documents, FORMS and Cascading Style Sheets. Released in December 1999, HTML 4.01 was being presumed to be replaced by a brand new language called XHTML-Extensible HyperText Markup Language. Recognized by all the modern browsers, HTML 4.01 serves as the perfect option for building an intranet where the browsers support just the 3.2 or 4.0 tags. W3C has always been recommending that authors and user agents prefer producing HTML 4.01 documents instead of HTML 4.0 documents. In addition to this, W3C also recommends that the authors must generate HTML 4 documents instead of HTML 3.2 documents. Last, but definitely not the least, W3C recommends that all the tools which are interpreting HTML 4 must continue supporting both, HTML 2.0 and HTML 3.2.

5. Fifth Version – HTML 5

Assumed to be the last HTML version, HTML 5 was released in January 2008 and was published as a W3C Recommendation on October 2014. Equipped with its own HTML serialization, HTML 5 has a syntax which reminds us of the very popular SGML syntax. Plus, this HTML Version also comprises of an XML that’s based on XHTML5 serialization. Although HTML5 isn’t fully supported by some older browsers, there are polyfills which can easily use JavaScript for making specific features work in these browsers. For instance, html5shiv uses JavaScript for allowing older IE (Internet Explorer) versions to recognize and style specific HTML elements.

Conclusion

So now that you know all the different versions of HTML, it is up to you to make a wise choice in accordance to your requirements. Hope the information provided above would enlighten you to take a good decision.

5 ways to Enhance User Experience

Today where internet is flooded with many options for web users, online businesses has changed their motive to keep their visitors interested rather than increasing sales. The better the user experience on the website, the better the chances of growing in the market. In order to make your online business a big hit, it is important to make your website user-friendly.

What is considered for making a website user-friendly? Is it the amount of information we offer on our website? Or how beautiful it looks? Though these two are considered important, there are many other factors that will definitely persuade your visitors in a positive way.

Here are 5 ways to enhance User Experience for your website:

But First, What is User Experience?

According to Wikipedia: User experience (UX) involves a person’s emotions about using a particular product, system or service. User experience includes the practical, experiential, affective, meaningful and valuable aspects of human-computer interaction and product ownership. Additionally, it includes a person’s perceptions of system aspects such as utility, ease of use and efficiency.

1. Implement Responsive Design

Responsive web design has been creating a buzz since its introduction. You probably have seen many websites making use of this new technology to drive more traffic to their website. Responsive design is no longer an option; it has become the need of the hour. Whether you already have an online presence or planning to build one, responsive layout is not something you can overlook in today’s world.
Responsive layout is a website design approach intended to craft websites to offer the best possible viewing experience to the user — easy navigation and reading with a minimum of scrolling, panning and resizing — over a wide range of platforms (from personal computers to smartphones).

2. Add Interactive Elements

Nearly every business is user-oriented. As they say “customer is king”, getting the attention of your visitors in the first few seconds is necessary to keep them interested in your site. Presenting interactive elements in front of your visitors gives them an opportunity to communicate with the site directly. Don’t make them wait for something they badly want, instead try to offer them options that address their needs. You can add infographics, a combination of content, images, videos, colors and movements, to make your content more interesting.

3. Get Feedback from your Visitors

Feedback is a great way to improve your website and services. You can either create one feedback page or simply make use of third party tools to get the valuable feedback on your website structure, design, page loading speed and appearance from your visitors. You can even install certain WordPress plugins like YOP Poll, Opinion stage, and Feedweb to know your visitors reviews.

4. Keep Social Media Registration Options

Nobody likes to register to a website. Adding social media registration option such as twitter, Facebook, and Google+ makes it easier for visitors to register and read your valuable content. You can even add Disqus and Facebook comments option to improve user interaction on your website.

5. Don’t use Newsletter Signup Pop-up

Let’s face it; we hate it when pop up comes up now and then while reading something on the site. These newsletter pop ups literally suck! I get it, you just want to produce some sales leads but it only increases the bounce rate of your website. Believe me, don’t ever use it. It is just not worth the time and effort!

Bonus! Other Techniques to Enhance User Experience

There are many more techniques to enhance User Experience (User Experience for the Web (WebUX) is a field on its own), such as:

  • Use a Consistent Design.
  • Optimize Graphical Elements.
  • Easy and Intuitive Navigational Structure.
  • Provide a Search Mechanism.
  • Short (to the Point) Registration Forms.
  • Place Important Information above the fold.
  • Use Breadcrumb Navigation.

How To Fix Disk Defragmenter Failing to Start in Windows

Have you encountered when you Click on the Disk Defragmenter tool, nothing happened? Or when you Right Click on the Disk Defragmenter tool and choose Open, or “Run as Administrator” nothing happened? If you did, then this tutorial might help you with a solution.

I am using Windows Vista Ultimate (64-bit) Operating System, and I am sure that the Disk Defragmenter problem has to do with an ongoing error on my computer as I described in a previous tutorial: How To Fix ´Failed to Connect to a Windows Service´ Error.

My Solution To the Disk Defragmenter Not Starting

My solution to the Disk Defragmenter Not opening is to make sure that the Task Scheduler has started. The Task Scheduler enables users to configure and schedule automated tasks on their computer. If this service has somehow stopped, these tasks will not be run at their scheduled times and also any services that explicitly depend on it, like Disk Defragmenter, will fail to start.

Here is my solution:

  1. Click the Start button.
  2. Click on Administrative Tools.
  3. Scroll down and Click on Services.
  4. Once the Services Console has opened, scroll down and double click the Task Scheduler to open the dialog box.
  5. In the General tab, if you notice that all buttons are greyed out (inactive), and more specifically the “Startup type”, and the “Start”, “Stop”, “Pause” and “Resume” buttons are greyed-out then STOP RIGHT HERE, it seems that you have a different problem and this tutorial will not help you. Check out the Reference section below for help.
  6. Otherwise, In the General tab of the Services Console make sure the the Startup type is set to Automatic, and in the Service status: click the Start button then press OK.
  7. Go ahead and click on the Disk Defragmenter, and see if it opens now.

A second method to get to the Services Console is by clicking on the Start button , then type services.msc at the search box and hit enter.

A Third method to get to the Services Console is by pressing the shortcut keys: Winkey + R, then type at the command line services.msc and press enter or click OK.

Did you know that the Task Scheduler is also responsible to run Windows Automatic Backup feature, in Backup and Restore Center tool for Windows Vista. This tool is called Backup and Restore for Windows 7.

Where is Disk Defragmenter? {Windows Vista/7}

There are several ways you can get to the Disk Defragmenter in Windows Vista or Windows 7. You could either:

  1. Click the Start button, and then double click on to expand All Programs, then click on Accessories, then System Tools, and finally click on Disk Defragmenter.
  2. OR: Click on the Start button, then type dfrgui at the search box and hit enter.
  3. OR: Press the shortcut keys: Winkey + R, then type at the command line dfrgui and press enter or click OK.

Your Turn to Talk

In this tutorial, I showed you the steps I took to resolve the issue of the Disk Defragmenter Failing to Start for Windows operating system.

26 Best Free Content Management Systems (CMS)

And you thought there are only three. This is my Twelfth post in this series. It is a convenient list, a one stop shop if you like, of the best free self-hosted Content Management Systems available these days.

What is a Content Management System?

A CMS or more specifically a Web Content Management System is a software system that provides Website authoring, collaboration, and administration tools designed to allow users with little knowledge of Web programming languages or markup languages to create and manage Website content with relative ease. A robust WCMS provides the foundation for collaboration, offering users the ability to manage documents and for multiple author editing and participation. Most systems use a database to store page content, metadata, and other information.

Which CMS to choose?

That is up to you, your needs and what programming languages your Web server support. I personally use Joomla and WordPress. But I can´t discount any of the others, that´s why they are listed here for you to choose from. To help you better make an informed decision to narrow your choices, try this CMS Comparison tool, and also try the CMS demos listed here. And most importantly, before you install your CMS software, make sure that your Web server meets the technical requirement.

For this post, I followed three criteria for choosing the best Content Management Systems.

  1. Free.
  2. In active development: still being updated and maintained (at least since 2010).
  3. In my opinion, the best.

Place your cursor over each image and link for a short description. Also try out the CMS software demos before you install. All links are External. Good Luck!

1. PHP based

The following Content Management Systems are mainly written in PHP scripting language. Your Web server must be capable of running PHP among other technical requirements.

  1. Joomla
  2. SPIP
  3. WordPress
  4. Drupal
  5. CMS Made Simple
  6. Typo3
  7. Concrete5
  8. Textpattern
  9. e107
  10. SilverStripe
  11. GetSimple
  12. Symphony
  13. sNews
  14. Contao
  15. Kajona
  16. Wolf CMS
  17. Pligg

Really Unique CMS Groupware

Tiki is one of the most feature-rich CMS packages. In fact, Tiki is the Open Source Web Application with the most built-in features. Tiki Wiki CMS Groupware, has all the integrated features you need “out-of-the-box”, like:

  • Wikis (like Wikipedia)
  • Forums (like phpBB)
  • Blogs (like WordPress)
  • Articles (like Yahoo News)
  • Image Gallery (like Flickr)
  • Map Server (like Google Maps)
  • Link Directory (like DMOZ)
  • Multilingual (like Babel Fish)
  • Bug Tracker (like Bugzilla)
  • RSS Feeds (like Digg)
  • Free Open Source software (LGPL)

2. Java based

The following CMS is written in Java programming language.

  1. OpenCms

3. ASP.NET based

The following 2 Content Management Systems are based on the ASP.NET framework.

  1. DotNetNuke
  2. MonoX

4. Python based

Plone CMS is mainly written in Python programming language. There are also other languages used within the project.

  1. Plone

5. Ruby based

The following 3 Content Management Systems are written in Ruby programming language as a Ruby on Rails Web application

  1. Radiant
  2. Refinery
  3. BrowserCMS

6. Perl based

Movable Type is mainly written in Perl programming language. PHP scripting language is also used for dynamic publishing.

  1. Movable Type

Your Turn to Talk

There are many more free Content Management Systems that did not make the list. Which CMS do you use? Do you have any others you think I should add? or anything else to say?