In the code below (from my functions.php), I'm attempting to create an array of items from the wp_postmeta table where the meta_key is "_wp_attached_file". I'm getting an error:
Fatal error: Call to a member function query() on a non-object
What's wrong with the query?
$excludeImages = array();
$excludeImages = $wpdb->query("SELECT meta_value
FROM $wpdb->postmeta
WHERE meta_key = '_wp_attached_file'");
array_push($excludeImages);