• Hi I need to change the permalink of one page but am concerned it will break all hyperlinks linking to that page. I have searched google but all I can find is advice on changing your permalink structure. I don’t want to change the structure just one page. Will all links to the page break as the url changes and if so is there a simple solution to preventing that?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @ahamaton,

    Yes, is possible to change permalinks on a single page but filtering the links on the page using some action and filter hooks. But you need to explain a little more about your requirements. Like which links you want to change, either your own custom links on the page or the permalinks of page, post, thumbnails, menu links etc generated by the WordPress by default and on which page you want to change the link like on home page or template page or custom page. Elaborate a little more for better assistance.

    Thread Starter ahamaton

    (@ahamaton)

    Thanks for getting back to me. It’s the permalink of the page itself. So I have a pricing page with the permalink ending in pricing-table but I want to change that to the link ending in membership-plans. However, I have posts on other pages linking to the permalink ending in ‘pricing-table’ so if I change that I am afriad I will break the links from those other posts.

    No, please notice that we always have some id of all the things in WordPress and for the pages we also have slug so we can customize the things on the basis of page id or slug so when you are changing the permalink may be in function.php or any other file just check the page id or slug of the page and if it match with the id/slug of the page on which you are changing only then allow the change like this:
    function permalink_changer () {
    if (get_the_ID =”123″) {
    $changed_link = “your required link”;
    return $changed_link;
    }
    }
    add_filter(‘hook_name’,’permalink_changer ‘,10);
    In this way, it will only change the permalink on the page have the page id as 123 and not on any other page.
    Hope this will help you.
    Let me know if you get it works

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Permalinks’ is closed to new replies.