0 Replies Last post: Oct 27, 2013 12:44 AM by Andrea Sciamanna  
Andrea Sciamanna Newbie 60 posts since
Sep 27, 2011
Currently Being Moderated

Oct 27, 2013 12:45 AM

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).

More Like This

  • Retrieving data ...