I can't seem to find a simple reliable way to do this - perhaps?:
// delete row ##
global $wpdb;
$delete = $wpdb->query(
$wpdb->prepare(
"DELETE * FROM `wp_table_name`"
)
);
// return ##
$return = __('Table Emptied.');
if ( $wpdb->last_error ) {
$return = $wpdb->last_error;
}
But this gives me the classic:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM wp_table_name' at line 1
$wpdb
instead of$this
?wp_table_name
which I doubt. There is alsotruncate
. I don't see how this is a WordPress question though.$wpdb
error. It is a just a SQL error.