How do I sort this custom list of sticky posts
This should do the trick: $sticky = get_option( ‘sticky_posts’ ); $args = array( ‘posts_per_page’ => -1, ‘post__in’ => $sticky, ‘ignore_sticky_posts’ => 1 ); $query = new WP_Query( $args ); $ids_by_category = array(); while ($query->have_posts()) { $query->the_post(); $post_categories = wp_get_post_categories(get_the_ID()); foreach($post_categories as $c){ $cat = get_category($c); $ids_by_category[$cat->slug][] = get_the_ID(); } } // sort by key ksort($ids_by_category); … Read more