When should I use $wpdb->prepare, if at all?
问题 I have a hard time figuring out if I should be using $wpdb->prepare on my database queries in WordPress to prevent things such as SQL injection. The $wpdb Codex shows some examples using the $wpdb->prepare function, and other examples not using it. Also, in this answer on StackOverflow, someone mentioned that a function such as $wpdb->insert has the same level of safety as using $wpdb->prepare . But what about other $wpdb functions such as $wpdb->get_var or $wpdb->query ? When should I use