WordPress

How to Remove Post Revisions in WordPress

Skill: Advanced
Estimated Time to Complete: 15 Minutes

Post Revisions is a feature in WordPress which saves all the modifications made to posts. If something goes wrong in your post, Just go to Revisions of that post and you can revert them back. Post Revisions play main factor in increase the size of your WordPress database. Due to these Post Revisions size site performance declines.

You can remove all your Post Revisions by executing a simple SQL query via PHPMyAdmin. There is a plugin called Delete Post Revisions.

But instead of using a plugin you can run the following query. If you have some experience on how to execute SQL Queries, you can do this easily. But if you are doing this for the first time then do it with extreme caution as it could crash your database. To execute this query, Login to your PHPMyAdmin and click on the SQL Tab and paste the following query:

DELETE FROM wp_posts WHERE post_type=’revision’;

You can also disable Post Revisions feature permanently. To turn off Post Revisions feature go to wp-config.php:

define(‘WP_POST_REVISIONS’, false);

Once the above Delete Query is executed in PHPMyAdmin it can be no longer accessible to the users. Cleaning Post Revisions once or twice in a month optimizes the Site Performance. But beware, You backup all the data before executing this query.

{ 0 comments }

Skill: Moderate
Estimated Time to Complete: 5 Minutes

If you are trying to call the category name in WordPress by the tag the_category( ‘, ‘ ); a link is automatically created to the
Using the above code you’ll get only the Category Name.Category Archive page. If you would like to call only the category name without linking the Category archives page to it.

For Example: If you want to show a Subscribe box which says, “Send me newsletters related to ‘WordPress‘ “. Using the default WordPress Category tag will link it to the Category Archive Page.

Use the code below for calling only the Category name:
[php]
<?php
$category = get_the_category();
echo $category[0]->cat_name;
?>
[/php]

After using the above code result should look like this: “Send me Newsletters related to ‘WordPress’”

{ 1 comment }