1, 'wlwmanifest_link' => 1, 'wp_generator' => 1, 'rds_link' => 1, 'wptexturize' => 1, 'wp_filter_kses' => 1 ); add_option('wpsanitize', $defaults, '', 'yes'); function wps_optimization_cron_on(){ wp_schedule_event(time(), 'daily', 'wps_optimize_database'); // rdd wps_optimize_database to wp cron events } function wps_optimization_cron_off(){ wp_clear_scheduled_hook('wps_optimize_database'); // remove wps_optimize_database from wp cron events } register_activation_hook(__FILE__,'wps_optimization_cron_on'); // run wps_optimization_cron_on at plugin activation register_deactivation_hook(__FILE__,'wps_optimization_cron_off'); // run wps_optimization_cron_off at plugin deactivation // Init plugin options to white list our options add_action( 'admin_init', 'wpsanitize_options_init' ); function wpsanitize_options_init() { register_setting( 'wps_options', 'wpsanitize'); } // Load up the menu page add_action( 'admin_menu', 'wp_sanitize_options' ); function wp_sanitize_options () { add_options_page( __( 'WP Sanitize' ), __( 'WP Sanitize' ), 'manage_options', 'wp_sanitize', 'wp_sanitize_options_page' ); } // Reset to defaults if (isset($_POST['reset-wpsanitize'])) { update_option('wpsanitize', $defaults); $msg = '

Settings Reset to Default

'; } // Manually Optimize Database if (isset($_POST['wps-optimizedb'])) { wps_optimize_database (); $msg = '

Database Optimized

'; } function wp_sanitize_options_page() { global $msg; $opt = get_option('wpsanitize'); ?>

/>
/>
/>
/>
/>

This plugin is brought to you by VibeThemes.com


get_results('SHOW TABLES',ARRAY_A); // get all table names foreach ($all_tables as $tables){ // loop through every table name $table = array_values($tables); // get table name out of array $wpdb->query("OPTIMIZE TABLE ".$table[0]); // run the optimize SQL command on the table } } ?>