Proper way to run wp_query from inside a plugin
Here is what solved it (although I am not sure WHY since any of the individual actions below did NOT solve it): I got rid of the action, changed from WP Query to get_posts, and moved reset above return. function myfunction(){ $mcpt_query = array(); $the_query = get_posts(‘post_type=mcpt’); foreach ( $the_query as $post ) : setup_postdata( … Read more