WordPress easy tips and tricks

 

 

 

How to Disable Post Revisions in WordPress

Open wp-config.php located in your WordPress root directory and add the following code:

define('AUTOSAVE_INTERVAL', 600 ); // seconds
define('WP_POST_REVISIONS', false );

Above code will disable all future revisions to be saved and it will also increase your autosave interval from 60 seconds to 600 seconds, so it means your post will be autosaving every 10 minute instead of every minute.

How to Delete Old Revisions in WordPress

By running the following SQL query in PHPMyAdmin:

DELETE FROM wp_posts WHERE post_type = "revision";

or from mysql> command line:

use yourdatabasename;
DELETE FROM wp_posts WHERE post_type = "revision";
quit;

Change “yourdatabasename” according to your own database name

How to Replace Text in your WordPress Database

First make a backup of your database just in case,
with phpMyAdmin the sintax for SQL query is:

update TABLE_NAME set FIELD_NAME =
replace(FIELD_NAME, 'Text to find', 'text to replace with');

you need to replace TABLE_NAME and FIELD_NAME,

example:

update wp_posts set post_content =
replace(post_content,'Text to find','text to replace with');

in above case TABLE_NAME is wp_posts and FIELD_NAME is post_content.
If you use mysql> command line remember to:

 use yourdatabasename;

before running replace commands

Also you can use a plugin called Better Search Replace

Leave a Reply

Your email address will not be published. Required fields are marked *