I'm having a problem with entries for a custom post type not being ordered as expected inside a custom query:
<h4>Related projects</h4> <?php $rp_args = array( 'post_type' => 'work', 'post_status' => 'publish', 'orderby' => 'title', 'order' => 'ASC', ); $related_projects = new WP_Query($rp_args); ?> <ul> <?php if($related_projects->have_posts()): while ($related_projects->have_posts()) : $related_projects->the_post(); ?> <li><a href="<?php the_permalink();?>"><?php the_title();?></a></li> <?php endwhile; endif; ?> </ul>
It's supposed to just simply pull out a custom post type and order it by name - but the ordering isn't working and I'm not sure why not.
It's simply listing the posts in the order they appear in the WP admin.
Any thoughts on why my ordering isn't kicking in? It finds the correct post type and number of posts I specify - just the ordering doesn't seem to work.