I’m digging into the
gallery.php code a little bit and I have a thought as to what the problem is. Let me know if this makes any sense.
This is the code to get the attachments form the database:
// find attachments (DISTINCT POSTS) $attachments = get_posts(array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post__in' => $value, ));
Is it possible that my
$query->set( 'meta_key', 'date_published' ); is affecting this query also, since it’s using
get_posts instead of making a brand new
WP_Query? So in my case, it’s trying to order the attachments by
date_published and since that doesn’t exist, it’s not returning anything? Will investigate further.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.