I have a custom-post-type called 'artists'. I list them by the order attribute (menu_order).

$args = array(
    'post_status' => 'publish',
    'post_type'   => array('artists),
    'orderby'=> array('menu_order'=>'ASC' ),
$wp_query = new WP_Query( $args );

When I use the_post_navigation() to get the previous and next links, it takes the date as the order instead of the menu_order. How can I get it to work right in this case?


Maybe this function is better to use get_adjacent_post.

I have not tested it yet but it seems to more flexible than the_post_navigation() function.

FYI, the_post_navigation() uses this function internally to retrieve the next and previous posts.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.