Server IP : 49.212.180.16 / Your IP : 3.145.165.235 Web Server : Apache System : FreeBSD www2606.sakura.ne.jp 13.0-RELEASE-p14 FreeBSD 13.0-RELEASE-p14 #2: Mon Dec 9 13:54:55 JST 2024 root@www5301.sakura.ne.jp:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 User : utannto ( 1076) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/utannto/www/hironaka.biz/wp-content/plugins/disable-revisions/ |
Upload File : |
<?php /* Plugin Name: Disable Revisions Plugin URI: http://wordpress.org/extend/plugins/disable-revisions/ Description: Disable revision functions in WordPress and delete all entries of revisions in database. <strong>It is extremely important to back up your database before install this plugin</strong>. Author: Slaver Author URI: http://slaver.info/ Version: 1.1 */ register_activation_hook(__FILE__, 'wp_disable_revisions_install'); /** * Delete all entries of revisions in database * * @global $wpdb WordPress database connection * @return $wpdb->query */ function wp_disable_revisions_install() { global $wpdb; $sql = " DELETE `a`, `b`, `c` FROM `" . $wpdb->prefix . "posts` `a` LEFT JOIN `" . $wpdb->prefix . "term_relationships` `b` ON (`a`.`ID` = `b`.`object_id`) LEFT JOIN `" . $wpdb->prefix . "postmeta` `c` ON (`a`.`ID` = `c`.`post_id`) WHERE `a`.`post_type` = 'revision' "; // Clean tables $wpdb->query($sql); // Optimize tables $wpdb->query("OPTIMIZE TABLE `" . $wpdb->prefix . "postmeta`, `" . $wpdb->prefix . "posts`, `" . $wpdb->prefix . "term_relationships`"); } /** * Set define WP_POST_REVISIONS to zero */ define ('WP_POST_REVISIONS', 0); /** * Remove revisions actions in post.php */ remove_action('pre_post_update', 'wp_save_post_revision'); ?>