admin管理员组

文章数量:1122832

I'm running the following query to get attachment data for a long list of post ids:

SELECT post_id, post_title, meta_key, meta_value
FROM wp_postmeta JOIN wp_posts ON wp_postmeta.post_id = wp_posts.ID
WHERE post_id IN ('list', 'of', 'around', '2500', 'post', 'ids', ...)
AND meta_key IN ('_wp_attachment_metadata', '_wp_attachment_image_alt', '_wp_attached_file')

Making this query with $wpdb->get_results($query, ARRAY_A) returns an empty array. But when I run the exact same query in phpmyadmin, I get results.

Wordpress docs say that an empty array is returned when there are no results, or when there is a mysql error, but $wpdb->last_error is empty. Is there is a limitation in $wpdb regarding query length (I'm not seeing anything in the docs)? Any ideas?

本文标签: mysqlwpdbgtgetresults() query emptybut same query in phpmyadmin has results