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?
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Adding additional data to WP_Post object
- WP_Query: Why is sticky post not first item in loop?
- How can I safely increase the character limit for post passwords?
- How to Group Posts by the First Letter or Number?
- WP_Query to work with custom view
- Most viewed post for the last 2 days using WP_Query
- Adding Post Counts to Menu (Nav) Programmatically?
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Unable to modify(update) posts – Page not found
- Hide Post comments when displayed via WP_Query
- Hiding posts in a list from specified categories
- wp query with dynamic taxonomies and terms?
- Blogroll – Different layout for first post
- WP_Query do not load specifed number of post
- Manually removing revision post types
- How much of my site can I recover from public_html?
- How do I use `posts_distinct` correctly?
- Automatic value for custom fields for posts
- Loop through all product posts?
- How to find what index page a post is on?
- Display post from current category and same tag?
- Get Posts that are in the current month or later
- WP Query to Get Array of Slugs
- Extracting post categories
- How can I sort posts by the date and a custom meta field?
- Hiding Draft Post In Admin
- How to verify wp user password by sql query in wp? [closed]
- How to filter my search in post if contains a word in title, content or excerpt?
- Lost draft under all posts and drafts
- Get user categories with most posts in it
- Query posts and return XML
- Copy post to separate database with “add_action(….)”
- 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]
- What do these phpMyAdmin errors mean on my WordPress databaes?
- 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?
- Delete all drafts?
- Ignore latest two posts
- Why my wp_posts data is so huge?
- Show posts by author of membership level (Paid Membership Pro)
- How to get posts published on the latest date?
- Why posts array is empty?
- Page and post loop same template
- How to check in functions.php if there is data in a WP_Query?
- Show metabox value last post excerpt, title and link
- How can I insert a new markup element after 4 posts automatically? [closed]
- If no posts exist for current day and month, show the next available day of posts
- how to handle the loop using filling bootstrap grid structure?
- wp_query if have posts show date but not in loop
- Query function not executed between element [closed]
- Custom WP_Query not working correctly
- Echo the number of posts being displayed
- Creating a related posts section in wordpress inside a default post
- How to display WP Query filters?
- Finding a post’s slug
- why the posts queried from sql is more than those showed on the page?
- Your ideas on my though “delete or move all of the posts in a specific category when 3 days are passed”
- Optimal WP Web App Backend for mobile app development
- How do I display main query posts in random order using add_filter
- My website is showing today’s date instead of published date since db migration to a new wordpress
- Bulk find & replace on WordPress posts/pages (minus image paths)
- query posts with selected post ids first
- Change URL of previous posts and next posts link in WordPress
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- Order posts inside bootstrap card columns
- Mix post date with post meta value using WP_Query
- How can I stop ‘in use’ message from intermittently blocking my wp_posts table?
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- Counting Posts by Category
- show image gallery in archives or category page
- Page with Category Returning 1
- The first post appears twice
- wp_query args with relation
- Get 5 most recent categories
- Creating Ordered Query using Meta_key
- Surrogate ID for posts, is there an alternative field in the posts table?
- Expired Post with More Recent Time Stamp?
- WP Query between posts custom fields [duplicate]
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Extra field in wp_post instead of postmeta
- Voting System, database connections?
- Retrieve latest post by multiple categories with ID
- Update Post with Modified Data
- Can’t get pagination to work
- How to Include a common category in a custom Category Search
- wp_query select if have comments
- wp_query posts sorting doesn’t work
- custom sort posts in archive/taxanomy page
- Trying to create shortcode listing custom posts, but formating not being included
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Get posts after calculating meta key
- How edit footer copyright info? [closed]
- What effect can a large wp_post table have on overall site performance?
- WP_Query post_tilte search in posts table