I've been working on this issue for several hours now and I'm stumped. The following query refuses to accept any orderby directive. NOTE: This is running on a single-cpt.php page within the normal WP Loop:
<?php $args = array(
'orderby' => 'title',
'order' => 'ASC',
'suppress_filters' => true,
'nopaging' => true,
'connected_type' => 'directory_to_projects',
'connected_items' => get_queried_object_id(),
);
$new_connected = new WP_Query($args);
// Display connected posts
if ( $new_connected->have_posts() ) { ?>
<h3>Projects</h3>
<ul>
<?php while ( $new_connected->have_posts() ) : $new_connected->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile;
endif;
wp_reset_postdata(); ?>
</ul>
<?php } ?>
I've confirmed I'm not running any page- or post-ordering plugins that might interfere with 'orderby'. Switching 'orderby' to something else (name, date, meta_value, you name it) has no effect whatsoever.
UPDATE: Actually, no parameters for wp_query are working at all. I tried adding 'posts_per_page' => 2, and that had no effect either. Must be a posts2posts thing but I believe support for that plugin has been discontinued. :( Anyone ever run into this?
Any ideas? Thanks so much for your help!