This is a PHP variable scope issue, there is no $wpdb
defined in your function.
Add
global $wpdb;
before trying to use the $wpdb
object.
This is a PHP variable scope issue, there is no $wpdb
defined in your function.
Add
global $wpdb;
before trying to use the $wpdb
object.