<?php // 2nd Method - Utilizing the $GLOBALS superglobal. Does not require global keyword ( but may not be best practice ) $results = $GLOBALS['wpdb']->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_id = 1", OBJECT );

wp do sql query from function

Similar Code Examples