Hi @Scott B:
Did you remember to include a global $wpdb;
in your code, like so?
global $wpdb;
$excludeImages = array();
$excludeImages = $wpdb->query("SELECT meta_value
FROM $wpdb->postmeta
WHERE meta_key = '_wp_attached_file'");
array_push($excludeImages);
Related Posts:
- Why is variable not working on custom sql query using wpdb?
- How to retrieve the data from the sever and displaying it in a page?
- How to insert wp_users ->user login name to wp_terms when a new user registering?
- WordPress SQL JOIN query
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Passing in MySQL prepare statement parameter separately throwing error
- Modify post image in full size
- How to return count of items found in SQL query
- Changing regular db connection to $wpdb
- If Query In Sidebar
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- Compare post-IDs within WP_Query? (Less than / Greater than)
- $wpdb->update with multiple parameters gives error
- How to use $query->set with post__in?
- Why do WP_Query results change after updating unrelated Advanced Custom Fields (ACF)?
- Loading the same WP_Query in two different wordpress .php templates
- How to prevent WP_Query function from returning all posts when empty?
- Querying wpdb using PHP
- Dynamic content based on a URL parameter
- Display a specific category of products in shop page and disable code for specific actions
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- Add more button if more 8 items
- How to store post ID’s in cookie or session to display the same posts later
- Update results, Before deleting the related category [closed]
- WordPress, AJAX and pre_get_posts using conditional tags
- Get users that likes the post
- How WordPress reacts to a lack of memory of the server [closed]
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Exclude posts based on meta value
- wp query foreach deleting record returning only first or last item
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Custom query, checking values of multiple meta keys
- auto-populating custom nav with all items from custom post type
- inserting a post from an extern php file but post content doesn’t show on wp site
- Database query works fine outside WordPress
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- Remove echo from shortcode
- How Can I use WP_Query to Only Display 1 Post from Custom Post Type if Query Returns Posts with Matching ID in Custom Field
- $wpdb->insert() does not Insert record in a table
- Help with a $wpdb MySQL Query
- WordPress theme options error
- Security for data obtained from the database
- Get posts from multiple post type
- Is it possible to retrieve all posts with a certain value for metadata?
- How to get all author posts outside of author templates
- WP_Query fails despite having 1 post
- Create a Blog Template Page
- unable to use ‘new WP_Query’ in AJAX call
- Custom array from a query only write the last row of the query
- wp_query get the 2nd post
- Exclude posts with specific metadata from search?
- How to get post ID in a Page?
- Display an image if odd number of posts in grid
- Error using WordPress $wpdb object to get result from custom table
- Querying Database with wpdb
- How to add div blocks after certain set of post
- $wpdb returns duplicate posts
- How to overwrite orderby with add_query_var
- Can’t update multiple rows with $wpdb query
- Mixing variables into an array when inserting values
- Wpdb->insert() doesn’t insert new row after the last one
- Why doesn’t PhotoSmash plugin play well with wp_query?
- how to get serialized post meta
- get_the_ID() in the footer returns wrong value
- Trouble inputting variable into WP query
- the_posts_pagination() not working in wpquery
- How to override url params with rewrite rules vars?
- Use $wpdb or other PHP script method to find/replace in WP database
- WP_Query: getting posts where custom field exists
- How to show meta value code HTML after x paragraph
- How can I add a new row in a separate database when someone registers via WordPress?
- Form search query – displaying ACF “Post Object” field as results
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- Convert a string into a decimal number for use in query
- How to display SQL query that ran in WC_Order_Query?
- get_the_ID() doesnt work
- How to get specific attribute from DB
- Basic wpdb update question
- Array to string conversion on array_map
- Store metakey value as an array
- Increment paged on WP_Query
- Target post_date_gmt if it’s empty or not set
- Hide posts if user is added to it WP_query
- I can’t update my data through $wpdb
- wpdb Cannot Update column in Database
- Custom route and query
- Output: “Array”
- change the default order of posts only for specific categories
- How to use mysql LIKE with wpdb?
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- PHP -> SQL Query with Summing
- How to hide posts of a specific custom category in WordPress?
- Delete database record using plugin from admin panel
- Post not populating for custom post type based on category selection
- Passing an array into WP_Query as a variable
- Custom query vars filters problem with pagination
- Custom post type permalinks do not appear using the link functions
- WordPress meta_query >= &