If you use a filter like the following to adjust the order of a post type archive, then the next & previous links will work perfectly without need for modification:
function wpse_139866_set_order_by( $wp_query ) {
if ( ! is_admin() && $wp_query->is_post_type_archive( 'my_post_type' ) && $wp_query->is_main_query() ) {
$wp_query->set( 'orderby', 'title' );
}
}
add_action( 'pre_get_posts', 'wpse_139866_set_order_by' );
Related Posts:
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- Filter next_post_link() and previous_post_link() by meta_key?
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- How can I get next post id after current post id for custom post type
- Problem excluding category from get_next_post
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Using previous_post_link and next_post_link to wrap around post sequence
- Working with Next and Prev links in Single Taxonomy Templates
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- Next and Previous Posts of Same Parent
- Modify previous and next post links to current Authors Other posts
- Why are previous_post_link/next_post_link skipping some posts?
- Add Previous/Next Buttons to CPT Single Pages Only
- Custom Posts and Posts – next_post_link and previous_post_link not working together
- Display next 3 posts based on custom taxonomy
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Prev/Next Navigation on Single Post Disappeared for Custom Post Type
- Back, Next, and Previous links for the REFERRING term archive
- get_previous_post_link and get_next_post_link of custom post type that share custom field value
- Previous/Next custom post links within custom taxonomy
- Next/Previous Post Links in single-[custom-post-type].php file
- previous_posts_link returns null when querying custom post type
- Custom post type – order field
- Order by & include array by specific post ids
- Sort Order for a Custom Query in a Post Type Archive Not Working
- Select All in Parent Category, Group by Child Category?
- next and previous post link ordered alphabetically
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- Order posts by (hierarchical custom) taxonomy terms and term children
- Compare 3 custom fields and sort by oldest
- List upcoming events, ordered by date in a custom field
- ascending order custom post type
- WP_Query post at custom position
- Sort custom post types by last name in the backend
- Custom Taxonomies: Multiple Hierarchical Permailnks For A Single Post + Prev/Next Links
- WooCommerce – Show orders for a specific product ? [closed]
- Re-order posts in query after
- Make `previous_post_link()` Function Show The Post After Next i.e. Jump A Post
- Display custom post types with custom date field value (before today) & order by custom date field
- Custom Post Type order by modified date and custom meta field issue
- How to query different post types in specific order?
- How to quickly reorder posts in the admin panel that will persist for the wp-api
- How do I make a custom taxonomy for a CPT appear inbetween title and editor boxes?
- Combining sorted and random CPT
- Show listings from Impress Listing plugin in random order using taxonomy and terms
- Rewrite and custom post type: order by custom field not working
- How to set order for a custom post type
- Previous/Next Link by Meta Value in CPT
- How to order separated Custom Post Search results
- Wp_query: sort by PHP variable
- Allow user to set custom order to a list of custom taxonomies?
- Sort CPT archive by order prevents sorting in admin
- How to do WP_Query with two meta fields with orderby clause
- Order Custom Post Type by Custom Field Value
- Get the taxonomy of a post hierarchically
- Change sort order when using ‘orderby’ => ‘type’
- Display Woocommerce Orders for specific author [closed]
- Ordering custom post type by multiple custom fields
- next/previous links on custom post single a little screwy
- Order by custom field meta_key date and then by custom file meta_key number
- 4 column-loop ordered alphabetically with entries grouped (and labeled) by their first letter
- Ascending Order is not Working in Custom Post Type Listining
- $wpdb->get_col and ORDER BY?
- How to use next_posts_link/previous_posts_link for custom post types paginate?
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- WP_Query of custom post type sorted by meta_key has unexpected results
- WP_Query not resetting after wp_reset_postdata
- Post ordering not working with custom field
- Filtered by a custom field, ordered by another
- orderby parameter not working in custom query
- show most viewed posts of last days by link?
- Changing WordPress sort order for returned child pages
- CPT : Next or Previous term link when has not adjacent post
- Display Parent-Child Posts in specific order by comparing IDs in array
- How can I sort the results of a REST API response by the title of a connected custom post type?
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- Orderby if between two meta fields
- Custom post type order by post_title
- SEARCH QUERIES – REVERSE OUTPUT
- How to order multiple custom post types with same taxonomy by date
- How to sort custom post’s category by id from the theme’s function.php?
- Show first posts with custom field not empty and order all by title
- WP Query with multiple post types ordered by custom meta date then published date
- Orderby modified only for specific post types
- Help ordering custom query by Title, Ascending
- shortcode order for event custom post type
- How to display custom post type ordered by a custom field date
- Order Custom Posts by Several Fields
- Custom Post Type Order Index Loop
- Ordering custom post type by custom field without a title
- Create custom post order (with custom post type meta)
- 404 on Pages for Custom Post Type & Query_Posts
- Trying to display next and previous set of posts on separate page (not parent page)
- Previous and Next posts
- Posts 2 Posts: query connected — orderby problem
- Order custom post type is beign ignored
- How to order different custom post type in category or tag template page?
- WP_query orderby not working after WP4.0 update [closed]
- Query order by meta value force specific tag first