To show prev/next links rather than numbered pagination you need to set the next_or_number
argument to next
.
Then if you want to remove the previous
links, you can filter the HTML for the links with the wp_link_pages
filter.
But, you can be craftier and filter on the wp_link_pages_link
hook.
Although it is used in a number of contexts, when it is called for the previous
link it passes a value representing the page number of the previous page. If you check this against the global $pages
, you can come up with the right logic to decide whether you are filtering a “previous” link rather than “next” or numbered pagination.
add_filter( 'wp_link_pages_link', 'wpse_235716_kill_previous', 10, 2);
function wpse_235716_kill_previous( $link, $prev ) {
global $page;
if ( $prev > 0 && $prev > $page ) {
return false;
} else {
return $link;
}
}
Related Posts:
- Stop WordPress Wrapping Images In A “P” Tag
- Stop WordPress automatically adding tags to post content
- Strategy for handling hierarchical pages with empty parent content
- How to remove Nextpage tag inside posts text depending of utm_campaign
- Getting the Next and Previous Posts Titles in the Sidebar?
- How can you make sure authors’ posts are longer than 250 words?
- What is the best / efficient way to get WordPress content by post id and why?
- the_post_navigation seems to ignore same category filter
- JSON not valid after json_encode posts
- Adding Post Counts to Menu (Nav) Programmatically?
- Add default content to post (for specific category)
- Programmatically inserting page breaks
- Navigation link to specific user page
- Hide parts of the post content on the home page
- Filter/Remove HTML Elements on all posts and pages
- Paragraphs removed when using get_post_custom()?
- Load post content into div with ajax
- Testing for post title in ‘if/else’ statement returns no content
- Same content shared between multiple posts?
- Post Navigation
- how load content as pop-up using ajax
- Batch process: remove first image from post content
- Restrict post navigation to current sub menu
- get_next_post() and get_previous_post() return wrong posts
- Disable most recent & view all (TABS) on nav-menu.php
- Why content_arr[‘extended’] removes paragraph tags?
- Unautop / Sanitize content added to a post through a plugin
- Is it possible to create a form post wordpress custom navigation link?
- is there a way to show the the post title after the image?
- remove older posts link [closed]
- How to get rid of shortcodes in post content once and for all
- Add Word Limit to Posts
- How to create a submenu that will navigate through different posts in the same page
- How to Next and Prevous Navigation Buttons on the end of the page with custom image Using Wp Post Navigation Plugin
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- One menu for frontpage (one pager), and a different menu for posts
- Show only posts with images and a fixed amount of posts
- Highlight static blog page link in header
- How do I do a page break?
- Show posts count for Categories and Tags in wp_nav_menu
- How to get a post’s content? [closed]
- Why does a published post only displays the title and not the content in the site? [closed]
- Restrict the_post-navigation to same category?
- Best Way to Add UnEditable HTML to Posts
- The_excerpt() doesn’t parse – how to change that?
- Page and post loop same template
- Benefits to using semantic HTML in post content? [closed]
- Navigate through the posts using keyboard arrows
- WordPress pagination and Post Navigation not working on home page
- the_content() Not Grabbing All Content
- Get current post’s nav menu name (term name)
- Can’t save WordPress post with “/etc/” in it
- content summary of a post disappears If an images added at the beginning of the post. how to solve it?
- Add Text Domain To Post Navigation
- Hide parts of the post content after typing it’s name or searching it by category
- How to exclude the word “class” from being matched in search?
- Preview page/post revisions without overwriting current content
- Posts and Pages w. private visibility don’t show up in existing content
- How to show next/prev link, when it’s not active?
- Possible?! A contextually titled back link
- Post navigation using date
- definining own teaser text for post
- Add text and change style to post programmatically depending on category
- How to Remove HTML Elements from Post Excerpt?
- Blog posts pagination not working
- My website is showing today’s date instead of published date since db migration to a new wordpress
- Related post not showing table of content
- How to get unmodified post content?
- I have inserted a post’s content in homepage.php by the post-id. The font isn’t matching with the theme. How do I change font of this content?
- Change URL of previous posts and next posts link in WordPress
- get_next_post() not working with future post status
- Excluding category from post navigation in WordPress?
- Creating a link to the first post in a category
- Next / Previous post in a single category
- How do I set content in my pages so that it remains permanent while blog posts are added below?
- Can the_post_navigation() be outside of the loop?
- Nothing appears using get_the_excerpt() in category.php
- Output wp_link_pages as raw url
- WordPress each user has each content for a page,how to do that?
- Add caption to thumbnails in content
- Adding div to WordPress page content
- Page and Posts loading as index page? Not loading the content
- Adding editable content above posts
- Custom template for different post types
- Correcting the content width when sidebar is inactive?
- Multiple approval from editors before publishing?
- Get part of a page url
- Count > 1 Navigation Slider
- How can i show only 30% of the “the_content(“More…”)”?
- How to use wp_editor(); in functions.php then retrieve content in the template
- Add default content to post (for specific category)
- jquery: getting contents of #content field on post page
- Stripping tag from elements in post
- What does WordPress mean by they have full rights to content [closed]
- How can I get the first post THIS SAME CATEGORY?
- wordpress pinboard theme [closed]
- Show a page counter for pagination
- Automatically search and replace link in content (pages/posts)?
- How can I merge a several related posts into one post?
- Notify/check if the content of a custom gutenberg block has changed on save_post