wpdb::prepare was called incorrectly

It’s always advised to use $wpdb->prepare when you are taking input from user. This will help in protecting queries against SQL Injection. For more details, check the Codex

When you use $wpdb->prepare, you must pass the variables to the query. In your case, you can skip using $wpdb->prepare as you are using a hard coded value. But if you have the same value in terms of a variable, you need to modify it as below

$post_type="attorneys";

$wpdb->query( 
     $wpdb->prepare(
          "DELETE a,b,c FROM wp_posts a
          LEFT JOIN wp_term_relationships b ON (a.ID=b.object_id)
          LEFT JOIN wp_postmeta c ON (a.ID=c.post_id)
          WHERE a.post_type=%s",
          $post_type
     )
);

Leave a Comment