Missing argument 2 for wpdb::prepare() Issue

That was not exactly change in code, that was change to better inform people they are not using the method correctly.

In line with wpdb documentation you need to properly pass values, or they won’t be properly escaped in query.

In your case it would turn into something like:

$wpdb->prepare("SELECT id, name FROM %s", $table_name)

Note that if $table_name isn’t coming from any untrusted input, then there is no need to prepare query in such case altogether.

Leave a Comment