I want to delete some unnecessary metatable from WordPress database, whenever I log out. I used the below code, but it does not work. I mean it's not deleting the table which I mentioned.
<?php
function delete_useless_post_meta()
{
global $wpdb;
$table = $wpdb->prefix.'postmeta';
$wpdb->delete ($table, array('meta_key' => '_edit_last'));
$wpdb->delete ($table, array('meta_key' => '_edit_lock'));
$wpdb->delete ($table, array('meta_key' => '_wp_old_slug'));
}
add_action('wp_logout','delete_useless_post_meta');
?>