How to write custom query in WordPress?


Suppose, we have a table "wp_states", we want to display all state where status = 1

$qry = "SELECT title FROM wp_states where status = 1;
$states = $wpdb->get_results( $qry );
foreach( $states as $row ) {
   // Display here state name by
   $row ->title

Suggest An Answer

No suggestions avaliable!

Latest post from WordPress Interview Questions

Ask Question