WordPress prepared queries

In WordPress you often make use of SQL statements such as this:

$post_type = $wpdb->get_var($wpdb->prepare("SELECT p.post_type FROM {$wpdb->posts} p WHERE p.ID=%d", $request_id));

In this case PhpStorm shows inpection issues for {$wpdb->posts} and for %d.

I wonder if there is a way to tell PhpStorm that:
{$wpdb->posts} = "wp_posts"
{$wpdb->prefix} = "wp_"
... and so on

Of course the "wp_" prefix must be customizabile, as most of the times I have to deal with cases where I have a different prefix.

And also it would help to have a way to allow query arguments (such as the %d).

Please sign in to leave a comment.