I just make some researches regarding to wordpress DB queries and I just wonder if I miss something

a normal SELECT query for example in Codeigniter with active records would look like if I assume I init my DB instance in both of the cases inside of a Class as $this->db

$data = $this->db->get('wp_mytable');

Wordpress way

$data = $this->db->get_results('SELECT * FROM wp_mytable');

and if I would use a condition than would look like

$this->db->where('id', 1);

I find this handy if I would use more than one WHERE as array

but I do not see this kind of query types in wordpress wiki or I do not search in the right place?


wpdb doesn't include such kind of API, mostly since it descended from ezSQL which didn't either (as far as I remember).

While there are some helpers for insert/update stuff, most of query abstraction happens in WP_Query since that's where bulk of complicated querying is typically going on.

  • anyway, maybe wordpress needs a better DB class if we compare with laravel or codeigniter – fefe Jun 5 '14 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.