Support » Plugins » Hacks » Change url of next_post_link, previous_posts_link

  • j.etter


    I’m trying to change the link of next_posts_link from ‘./page/2/’ to ‘.?paged=2’ and similarly for previous_posts_link.

    I’ve been struggling through information I’ve found online to no avail for the last few days. Anyone know how to do this? Thanks so much.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz


    Hook the ‘next_post_link’ and ‘previous_post_link’ filters to alter the HTML of the functions you mentioned. I don’t think those functions output page number links though, I believe you would use wp_link_pages() for that, and then use the ‘wp_link_pages_link’ filter to alter the HTML for each individual page link in turn. The ‘wp_link_pages’ filter would give you all the HTML for all the pages at once.

Viewing 1 replies (of 1 total)
  • The topic ‘Change url of next_post_link, previous_posts_link’ is closed to new replies.