Try this after your $wpdb
query:
// collect calendar id's
$ids = array();
foreach( $calendar_entries as $calendar_entries):
array_push( $ids, $calendar_entries->id );
endforeach;
// query the above calendar id's
$args = array(
'post_type' => 'post',
'post__in' => $ids,
'orderby' => 'id',
'order' => 'DESC'
);
$query = new WP_Query( $args );
You can also modify the WP_Query
by using posts_where, posts_join
and posts_clauses.
Related Posts:
- How can I query the db to access current post information?
- get_results using wpdb
- Count & Display Database Queries
- Importing posts from old website to new conflicting post ID’s?
- Export wordpress table to excel
- How best to inject ads between posts in the loop?
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Change all http to https in mysql databse?
- WooCommerce – Query for ordered products
- PHP variable in WordPress database query
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- When and why should I use $wpdb different return types?
- Query WordPress database by registered date and role
- How to prevent WordPress from retrieving data for the last 10 posts in the database?
- Query from a different database than the default
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Select Multiple meta_value from WP DB; Single Query
- how to store arrays into a database
- CRUD operations using WordPress database API
- Hook directly into query execution
- get_tags() return an empty array after added tags with wp_insert_term()
- Storing Array from returned database query and using the array in a new query
- Advanced SELECT query with condtional statements
- Select two sums with single get_var statement
- Replace/Mute/Stop Search Query
- sanitize POST arrays
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- cache specific data?
- How Can I Put Meta_Compare in the Database-Query?
- How to paginate information obtained from a query to a custom table?
- Historic WordPress database connection
- Check if an option exists and get its value in one hit
- Query multiple tables at once?
- $wpdb->query can’t insert data
- Custom WordPress Table wpdb
- Best practice to limit results in get_row()?
- How to display content from external db with relevant urls
- Connecting to a different database
- SQL query to set posts in bulk based on the post content
- Query Column of Specific ID from Database Table
- Custom search query by category id
- How to display data from db in select list [closed]
- Compare User meta_value with Product meta_value
- wpdb Insert unknown post data dynamic foreach loop
- How to insert a value to decimal type field using wpdb->prepare?
- Join Query on WP_USERMETA Table
- Insert NULL value using prepare()
- Job and Employee Performance Tracking with Product Safety
- WordPress Settings API Overrides My Previous Value
- WordPress Database Query works in phpMyAdmin but not in the code
- wpdb query to insert images in to post/page gallery
- Set SQL_BIG_SELECTS and MAX_JOIN_SIZE on a WP_Query
- Performance bug – slow DB query
- How to optimise this database query?
- How can we speed up wp_get_nav_menu_items()?
- Extracted CSV as Array for Custom Query Loop
- Should I Use only wpdb Class to Write Custom Queries?
- Generating an HTML table from an array based on dynamic key values
- Get id from database
- Unserializeing multiple column values that are stored in one database results variable
- Pulling values from a sepcific row in table
- Create hundreds of users with just ID in phpMyAdmin
- WordPress loop: Display if posts exist
- database search feature
- Query parsing only author ids
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- How do I find users by password?
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- Does dbDelta delete columns as well?
- Reversing the order of posts AFTER the query is performed
- Insert data in database using form
- Special characters in WordPress UTF-8 [closed]
- Scheduling posts in database
- Need of separate security plugins for both root and subfolder sites WordPress?
- Escaping / encoding data before insert into a database?
- Error: SELECT SQL_CALC_FOUND_ROWS
- Populate dropdown from database
- Weird orderby => post__in issue
- wordpress ‘database update required’ loop after update
- Database Table for customer user
- How to Access wp_usermeta Data Immediately After a New User is Created
- How to display posts by vote count and if no value continue with latest posts with no votes?
- Error establishing a database connection,
- Post Views / Hit Counter Problem?
- Trying to create a custom meta table for working with a custom table
- Regenerate user_nicename column
- Create Pages for database content
- Should I use an additional column in the DB?
- Can’t log into wordpress site – I have made a new user and still cant access
- How to save EXIF metadata in WordPress database?
- Recurring 502 Bad Gateway issue
- getting the values of hidden inputs to use them in a php mysql query
- Updating database with CSV file and Cron job
- Improving wpdb queries with large data
- Why is wordpress trying to re-install itself?
- How to Determine a Post’s Last Edited Date?
- How to stop WordPress from using utf8mb4_unicode_ci collation
- save array of objects with update_option
- WordPress database connection failed, while mysql client is working [closed]