You can’t easily change only the URL of that link, because there is no filter that will allow you to do that, but…
next_post_link
uses get_next_post_link
. There are no filters in any of these functions, but… get_next_post_link
uses get_adjacent_post_link
and inside of that function you can see {$adjacent}_post_link
hook.
So now we can check docs for that hook. And then write some code:
function my_next_post_link($output, $format, $link, $post, $adjacent) {
return '<a href="https://wordpress.stackexchange.com/questions/325546/<MY LINK">MY LINK LABEL</a>';
}
add_filter( 'next_post_link', 'my_next_post_link', 10, 5 );
PS. Most likely you also have to add some conditions in there, so you don’t change every link on your site and only the one you want to.
Related Posts:
- Conditionally (cpt) filter previous and next_post_link
- Changing WooCommerce Display Price Based on User Role & Category [closed]
- Not able to change wp_title using add_filter
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- Remove Editor From Homepage
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- What do add_filters() and apply_filter() do?
- SSL certificate for the host could not be verified
- Store source permalink on XMLRPC calls
- What to use instead of the content_save_pre filter?
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- How can I customize the wp_list_categories
- How can I reliably and globally disable wptexturize?
- Customise Jetpack Publicize text
- Can’t change a label in woocommerce with the normal filter
- WordPress RSS feed – filter RSS content by custom field value
- What is the filter hook for custom fields content?
- Filter keywords from search query
- Add classname to the_category() function?
- Filter the URL of next_posts_link & previous_posts_link
- Sensei LMS Hooks to Remove Content
- How to re-enable a filter after disabling with __return_false
- Exclude One Category and its Subcategories using WP_LIST_FILTER
- Explanation for remove_filter used in the below code [closed]
- How to change the blog title with add_filter? details below
- Gutenberg disable the “block” tab in right sidebar
- add_filter to ‘woocommerce_before_main_content’ [closed]
- Editing
- the_content filter – checking the post
- add_filter to apply_filters that exists within class
- Echoing Categories only if they’re a child of a given category
- How do I target a single page to modify the comment form of only that page?
- Removal of Jetpack OG Tags from old blog site
- Adding a title prefix with the the_title filter
- How to removes all instances of thumbnails displayed in my theme?
- Contact Form 7 filter similar to preprocess_comment [closed]
- How to modify an existing meta description?
- Adding TinyMCE buttons without removing plugin buttons?
- Don’t see add_filter result in the site front page
- How can I include an existing custom sitemaps listing in wp-sitemap.xml?
- Display Externally Retrieved Data within a Custom Template
- Can the wordpress color palettes by changed through Javascript?
- Filter on the_content doesn’t update the content being searched via register_rest_route
- Where to add_filter in theme functions.php?
- tag removed not using a filter
- How to customize the “Insert/edit link” popup box?
- How to filter backend post list showing only posts having a shortcode
- WordPress Image update filter
- How to remove this filter?
- Why does WordPress strip custom HTML that are form elements and theme SVG icons?
- Get current user data
- How can you wrap add_filter with a if is_home() statement?
- How to add attributes to WordPress Admin Sub Menu List Items
- How to combine multiple body classes
- How to replace username with email address in users table
- How to write a filter to remove a form field (WordPress) [closed]
- Why doesn’t this function work when I know that the IP Address is “true”?
- why require – does not load filter
- term_link filter rewrite link only applying half of condition?
- How to change dynamically page title according to variable data?
- Map plugin with proximity search compatible with Buddypress
- How can I filter tag_description()?
- Create a pre-filtered version of the Media Library
- What is the action hook to use if you want to capture the new password during password change?
- Get_template_part inside filter?
- How to filter Sidebar Content
- Removing URL and adding container around image in the featured image metabox
- How would I use a filter to remove header banner on certain post types
- Need to return shortcode text instead of the output
- Replace Data In Post & Update Meta Field Post Is Saved
- Dashboard filter based on custom fields URL response code
- Customising the default wordpress search functionality
- I want to add string array to this function to filter displayed option in drpodown [closed]
- Ajax filter – show all results that contain at least one filter
- WP_Query filter by custom meta
- How to add a blog filter bar without paying money. (example inside)
- How to wrap pattern-matches from the_content in [wiki]-shortcode tags
- how to develop a filter in wordpress to let the user filter the page content depends on the date (newest to oldest etc…)?
- Print only parent categories of post in custom RSS feed
- Action for opening attachment or manipulating all attachment links
- Filter wp_mail based on content type
- Remove the post_content search from WHERE clause (and CONCAT sql function)
- mu-plugins body_class filter not working
- How to apply a filter to everything?
- WP Job Manager – display search results from custom search form in taxonomy-job_listing_category page
- Post filter Month dropdown at front-end like wordpress backend
- shortcode function outputs multiple anchor tags
- changing size image within the content
- WP Dashboard -> Posts-> Filter by Category -> Form Method Change : Which Hook
- Show child theme for users on specific IP
- wp.getPosts with status = ‘trash’ using node.js
- Is there a way to overwrite a filter used in canonical.php?
- How do I remove certain HTML elements with specific classes from the feed?
- Sanitizing a custom query’s clauses
- How can I display wp_link_pages before a shortcode, if it is used, or display after content?
- confusion with add_filter
- post->post_content filter
- How to change this WP logo and posts url in block editor?