From the research I was doing, and from hearing from Kero in the comments, it would appear that querying for posts with attachments via WP_Query
isn’t possible in a concise manner.
With that in mind, I changed my podcasting plugin to no longer pull posts with attachments (since that could ultimately be unreliable anyway), and instead save the podcast enclosure
data in postmeta
. That way, I can use WP_Query
and just add a meta_query
to the pull.
If you’d like to see the plugin as is, you can find it in this GitHub repo.
Related Posts:
- wp_posts table: safely remove unused columns to save database storage
- Is there a function to get post info for any publish_status by post ID?
- How Can I Always Display A Particular Post First Using WP_Query?
- Exclude the first ‘n’ number of posts of a tag from home page?
- Query posts and return XML
- Can’t update old posts 3.5.2
- how to change the number of posts returned in a specific loop without making it global?
- Query Posts With Over 1000 Views
- Copy post to separate database with “add_action(….)”
- posts_per_page option limits the number of Gallery items
- List authors with the last post title and order by last post date
- How to order posts by meta_value and title
- When open add new post or page WordPress add post with ID=0 continuously [closed]
- wp_query random post
- Query Posts by Custom Field
- Anyone know why wordpress converts some html entities to their numeric equivalents?
- Adding a blog archive with pagination using WP_Query
- How to get Tags with specific post id
- Remove a shortcode from all WordPress posts
- how can i change WP main archives loop to sort by name or title
- Using wp_list_pages() after calling query_posts()
- What do these phpMyAdmin errors mean on my WordPress databaes?
- how to get post order by post id wp_query?
- Possible to alternate between two loops
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Nested WP_Query breaking loop
- WordPress query_posts by tag doesn’t work anymore(?)
- why there are so many posts whoes post_type is revision? will these records waste too much database space?
- How to display all posts divided/ordered by post date? [closed]
- Why Query is returning empty array?
- How do I extract just the post ID of the first item in whatever WP_Query returns?
- Delete all drafts?
- Show post content and title in diferent divs using WP_Query using a loop
- Why are my paginated posts always returning the same results?
- Ignore latest two posts
- Get posts and include taxonomy term
- Why my wp_posts data is so huge?
- Show posts by author of membership level (Paid Membership Pro)
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- meta_value timestamp older than now
- Every second post different class in blog view
- Loop doesn’t exclude the specified category in home page
- Get posts with multiple categories
- Do not show children of a category
- Display posts of specific category term
- Add field to user meta table in database when link is clicked
- Print out last 3 blogposts
- why the same code got different results when using query_posts in functions.php and index.php
- Query posts by Author and/or by Tag
- Query for first 3 posts to change the look and feel
- How safe is it to delete old posts edits to save database space?
- How to get posts published on the latest date?
- Why posts array is empty?
- Can’t understand why sometimes a [caption] field appears
- Page and post loop same template
- Getting blog pagination to work on page set as front page
- How to group only VISIBLE posts? [closed]
- How to check in functions.php if there is data in a WP_Query?
- Shortcode with ‘year’ parameter
- search blog posts by author first name and or last name
- Show metabox value last post excerpt, title and link
- Delete post revisions only for a single post
- On what hook can I get the queried object’s final state?
- Move posts from a non-wordpress site to wordpress
- wp_posts table extremely large
- unique post in “$args” of wp_query display more than one post
- Display current post position in Elementor Posts widget
- How to Assign / Move all Deleted post to a category
- Why in my query is display two title?
- Migrate posts from category and sub-category via SQL
- How do I insert a after every 5 posts in a WordPress Loop that infinitely loads posts?
- wp_query with ajax
- How to give classname to post if post has no content?
- Custom wp-query in wordpress rest api
- Display post number by category
- Saving Post Data in Another Database
- WP_Query: Show 10 posts in date order, first three random
- How can I insert a new markup element after 4 posts automatically? [closed]
- Exclude some posts from displaying in wp_query based on some condition
- posts_per_page returning only one post
- If no posts exist for current day and month, show the next available day of posts
- WordPress Loop: How to display recent posts in multiple divs
- Random posts that always include a particular post?
- Need to know custom code to display random and most viewed posts in wordpress posts and pages
- Related Posts function not working
- How to retrieve certain number of images from a wordpress post?
- WordPress post filter menu
- How to display post list in a table layout (multiple queries in single loop)
- Restore woocommerce orders
- Conflict array_splice on loop and query in widget
- Not all posts showing in query
- how to handle the loop using filling bootstrap grid structure?
- Get all custom posts with a certain taxonomy
- WP_Query custom field pass the post id
- How to convert query sql to shortcode in wordpress?
- Link to date_query results in WordPress
- wp_query if have posts show date but not in loop
- How to select particular month post from table and update the post status using MySQL?
- Use posts_where to exclude posts ids from wp_query
- Query function not executed between element [closed]