Support » Plugin: WC Delete all orders » Delete not working

  • Hi,

    The plugin does´nt delete correctly, not only because database prefix should be added but also because the query is not concatenated, so only executes the last query.

    $queries = $results = array();

    $queries[] = “DELETE FROM {$wpdb->prefix}woocommerce_order_itemmeta;”;
    $queries[] = “DELETE FROM {$wpdb->prefix}woocommerce_order_items;”;
    $queries[] = “DELETE FROM {$wpdb->prefix}posts WHERE post_type = ‘shop_order’;”;
    $queries[] = “DELETE FROM {$wpdb->prefix}posts WHERE post_type = ‘mail-debug’;”;

    foreach( $queries as $query ) {
    $results[] = $wpdb->query( $query );

    Error treatment should be implemented later.


  • The topic ‘Delete not working’ is closed to new replies.