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
- Can i use php sql functions instead of $wpdb?
- wpdb::prepare was called incorrectly
- Custom query to get post names beginning with a digit
- WP_Query | Help me create a search term with an ‘OR’ relation?
- PHP syntax error when using wpdb update?
- Duplicates with WP_Query loop
- “The plugin generated 2694 characters of unexpected output…” on Plugin activation, CREATE TABLE sql command not working
- How do I dynamically generate args for wp_query?
- Use wp_get_recent_posts with search term
- have_posts() execution failure
- Can’t search posts using WP_QUERY inside AJAX Function
- How can I use wp_query to show all product data using just the products ID?
- Get Current User Id Inside a Loop Returns 0 For a Shortcode
- Get stock by custom meta field on all Woocommerce variable products
- Custom page archive query by url var calling page twice on one of my custom queries?
- How to query for posts with a null or blank post_name?
- WordPress pagination not working with search page
- Display fields as values in array from external SQL DB
- WP Query with custom Shortcode
- Getting id of poll from WP database
- Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)
- I want to select the from values from database in WordPress? [closed]
- WP_Query adds “(wp_posts.ID = ‘0’)” so no results are returned
- How to store post ID’s in cookie or session to display the same posts later
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- auto-populating custom nav with all items from custom post type
- WordPress theme options error
- unable to use ‘new WP_Query’ in AJAX call
- wp_query get the 2nd post
- How to add div blocks after certain set of post
- $wpdb returns duplicate posts
- Wpdb->insert() doesn’t insert new row after the last one
- Convert a string into a decimal number for use in query
- How to get specific attribute from DB
- Increment paged on WP_Query
- Hide posts if user is added to it WP_query
- PHP -> SQL Query with Summing
- How to hide posts of a specific custom category in WordPress?
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- Modify main query before it run without pre_get_post
- WordPress WP_Query without query GET parameters
- Sort posts in a specific way
- Change MySQL PDO connection to a WPDB connection
- $wpdb->get_results breaking page?
- WPDB secure custom form
- foreach loop inside the loop creating duplicates in output
- posts_nav_link pulling in multiple post types
- Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin
- displaying a fall back query if there’s nothing in the post-type category
- Query the links Database
- Modifying WP URL handing code?
- Free search and custom taxonomy query not providing the same result
- How do I reset $wp_query in a function?
- wp_query with multiple arguments with AND
- Replace a single variable with add_filter
- Nested Queries of decreasing specificity
- Wrong pagination results, page counter resets when navigating
- WordPress SQL Prepare
- Is it possible to order posts using multiple meta queries, i.e. show posts from first meta query, then the second?
- Sending simple variable on single page to WP JSON
- How to exclude meta no index pages from wp_list_pages
- meta_query search names when they have middle initials
- Define global custom post
- What is the correct way to search 3 custom fields only in WordPress?
- get_filtered_term_product_counts – Get product terms if any products
- List all ACF field values across every post on one page
- Multiple Arrays for Custom Post Query using Boostrap accordions and ACF repeater fields
- Query to show average # of months all accounts with specific role have been active
- Query doesn’t display text data with apostrophes
- Querying posts from wordpress with 2 or more conditionals
- SQL Query Search page
- Display Year and Month from custom field + Age Calculator
- insert thumbnail image from php script
- WP_Query count of different meta key values [duplicate]
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- Masonry layout within the loop
- MySQL queries in WordPress
- At what point during a typical request does the $wpdb object become available?
- Get null from POST
- wp_query on search results page showing all results every time
- Insert into db with foreach problem
- posts_clauses drop ACF get_field function
- WordPress Query -> Ajax Query
- how to display tables via ajax
- Execute multiple PHP Snippets causes error?
- use wpdb object on other file
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- How to sort search result by post_title, then by post_content
- Warning: Undefined property: wpdb::$question_overview in C:\Wamp.NET\sites\proxyvragenmodule\wordpress\wp-includes\class-wpdb.php
- WordPress / PHP: Check if column has value and then check if value in array
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress