Page Links To

About

Page Links To is a plugin that allows you to make certain WordPress pages or posts link to a URI of your choosing, instead of their WordPress page or post URI. It also will redirect people who go to the old (or “normal”) URI to the new one, using a redirect style of your choosing (302 Moved Temporarily is standard, but you can enable 301 Moved Permanently redirects i f you wish.)

For instance, say you have a photo gallery installed, but can’t be bothered to integrate it into WordPress. You’ll still probably want to have a link to it from your WordPress blog. With this plugin you can create a new page called “Photos,” and give it a Custom Field links_to with the value being the URI to your photo gallery. “Photos” will show up when you use wp_list_pages();, but instead of linking to the (blank) “Photos” page, it will link you your photo gallery!

Another usage scenario is that you have content that was on a post, and want to move it to a page. You could redirect the post to the new page. And if you use a 301 redirect, search engines will eventually “find” the new location and change their links.

This plugin uses only two simple MySQL queries, no matter how many total pages or links_to enabled pages you have, so you don’t have to worry about scalability.

Usage

To redirect a page or a post, scroll down to the “Custom Fields” section on the edit screen for that entry and enter in a key of links_to with the value being the full URI you want to redirect to. If you want this to be a permanent move, you can additionally add a meta key of links_to_type with a value of “301″ (without the quotes). After saving the entry, the redirect will be active!

New in version 1.3: Now you can create a links_to_target meta key, and provide the target you would like for the link (like _new, to open the link in a new window). The target you choose will be used in wp_list_pages().

Download

Instructions

  1. Upgrade to WordPress 1.5.1.3 or higher (WordPress 2.0 required for tab highlighting feature)
  2. Upload page-links-to.php to your /wp-content/plugins/ directory
  3. Activate the “Page Links To” plugin in your WordPress administration interface
  4. Create (or edit) a page to have a title of your choosing, and a parent page of your choosing (leave the content blank)
  5. Down below, add a meta key of “links_to” (without the quotes) and give a full URI as its value

That’s it! Now, that page will link to the “links_to” URI instead of its WordPress page URI.

Possible Uses

  • Linking to an on-site non-WordPress resource (e.g. photo gallery)
  • Linking to an off-site resource (e.g. Flickr or del.icio.us page)
  • Placing a link to a 2nd, 3rd, or nth level page on the top level (i.e. you might have /archives/tags/, but want “tags” to show up on the top level)
  • Adding a link to your blog’s front page without having to modify your template and hack it in manually

Leave any bug reports or feature suggestions here in the comments.

Versions

  • 1.4 Fixes to tab highlighting
  • 1.3 You can now specify a link target via links_to_target, tab highlighting moved to WordPress 2.0 style
  • 1.2 If you link to an internal WordPress page, like a category, the menu item will get the current_item CSS class when you’re on that page
  • 1.1 Posts can have redirects, can specify redirect type (301/302), get_permalink() is filtered for posts.
  • 1.0 Initial public release.

I’ve spent a lot of time writing this code and supporting it. If you derive some benefit from this code, please consider showing your gratitute in a more tangible
way. Thanks!

I have received $0 this month for my coding efforts.

Donate with PayPalAmazon.com Wishlist


511 Responses to “Page Links To”

Comment pages: « 1 2 3 4 [5] 6 »

  1. tonneti |

    thanks for this great hack!! ;)

    greets

  2. Faceless |

    wow! thx. But i don’t get it.

  3. Robert |

    I tried this on version 2.2.2 and when I go to save or publish a page it disappears. Anything I am doing wrong, or just not compatible?

  4. Midoe |

    doesnt work well with wordpress 2.3
    please fix it cuz when i add a page and publish it, it automatically switches to a drafted post.

  5. Dave |

    Oh, this is great - I’ve been looking for a plugin like this for some time. I’ve wanted to make some external links in the “pages” section without hacking my wordpress installation to death. Good show. and thanks!

  6. Whatever-ishere |

    thanks for the GREAT post! Very useful…

  7. Rhian |

    This plugin does work with Wordpress 2.3, but you need to create a blank page (with your chosen title, and no content), publish it, and then edit it to add the links_to tag. Just a heads-up.

    Otherwise, it works perfectly and is proving to be very useful, so thanks for making it!

  8. Dale |

    Nice work, but i still am unable to get subscribe to comments to work

    http://dzrbenson.com/blog/

  9. rivka |

    I’ve followed every direction given here (including creating a blank page and going back to edit it), but still, when I click the “store” link on my nav bar, the address that appears in the new tab is
    “my website address”"my store address”. How do I get only the store address to register? What am I doing wrong? thanks…

  10. lawsuit settlement cash advance |

    [url=http://lorans1975.spaces.liv

  11. David Peyton |

    Hi Mark,

    It seems that your permanent 301 redirects are broken in 2.3.2. Just thought I’d drop you a line to let you know!

    The non-permanent redirect works though.

    Thanks for the great plugin!

    Regards,
    David

  12. Bernienor |

    Im using this ona few blogs, works great - but on one of my blogs its not working at all.

    WordPress database error: [Column 'post_id' in field list is ambiguous]
    (…)

    What can be the issue?

    Thanks :)

  13. LCarter |

    I’m confused. I installed the plugin. Created a new page. Opened it up to edit it.
    Now what?
    Where exactly do I add the link to? What exaclty do I type?Can someone just type it out for me? I’m a newbie!

  14. aidilazhar |

    hello….help me…previous when i using wordpress 2.1 ..ur plugin works like charm…but when i manually upgrade to 2.3.2 .. it no longer function. or i have wrongly upgrade the version..help me.. when i add the value…the value is not there

  15. Alexander Joffre |

    James,

    On the Edit Page screen doesn´t appear the Custom Fields section with the options “links_to”. What could be the problem?

    Thanks.

  16. Adham EL-Shehaby |

    Thanks for the plugin
    Adham from Egypt

  17. Samiha |

    Thanks a lot for great code. I’m ready to make a donation for you, but Paypal is not support fully to our country. I’ll find a way.

    Many thanks

  18. shoban |

    Hi
    Thanks for this plugin….

    Shoban

  19. David Peyton |

    Hi Mark,

    It appears that the “links_to” has disappeared from the custom field as a dropdown. I have the same problem as Alexander.

    Regards,
    David

  20. mlindahl |

    Great tool, thank you! I was quite annoyed when I found out WordPress can’t do this natively. I did a little research, stumbled upon your plugin, and walah! Thank you very much!

    Matthew Lindahl
    http://www.atmatthew.com

  21. Rebecca |

    Any chance that this plugin will be updated? It’s not working for 2.3.3., it seems to disappear when I attempt to create a new page, and the new page won’t be created at all.

  22. Low |

    Thanks so much for creating this plug in.

  23. Treneiplinc |

    rosie@triad29.com

    rosieponder@verizon.net

    Not only do they try to rip you off, they send your email out and you get a ton of junk mail.

  24. aviro25 |

    does anyone know how to fix page links to in new wordpress version. The link is not working.. Missing variables

  25. phx |

    Hey,

    a really kick ass feature would be if the link clicks were counted.

    So i can display the link clicks.

    :)

  26. Pierre K. |

    Very nice plugin. I have used it to “block” root pages at the top of drop-down menus, by setting the links-to value to “#”. Thank you !

  27. segmeant |

    I have a static home page for my site, and i’d like to create a blog link for the post page. Only thing is, i’m not sure how to link to it as it links to index.php by default, and that is what the static page ends up being once that is declared. Is there a work around for this issue. Hard to believe this hasn’t been done before. Thanks very much, great plugin!

  28. segmeant |

    My apologies for the previous post. As I continued my search I was led to the obvious. Right under the Dashboard Options Page where I declared my static home page there is an option for me to declare my post page. I could then declare my Blog page to be the posts. (duh, must open eyes) I thank you for the plugin!

  29. Canadian Free Stuff Guru |

    Lovely wordpress plugin! Wordpress should integrate this into their core system.

    Thanks a lot

  30. jeff macdonald |

    it would be neat if you could make a new field that says “no_link” that could make it so just the word appeared, with no … that way you could make parent pages into just category headers that don’t link anywhere.

    for now i make link_to point to # to accomplish this.

  31. Silk Wedding Flowes |

    # Rhian Says:

    This plugin does work with Wordpress 2.3, but you need to create a blank page (with your chosen title, and no content), publish it, and then edit it to add the links_to tag. Just a heads-up.”

    Thanks Rhian this worked a treat

    Andy

  32. tianyi |

    It works well on WP 2.5! Thank you!

Comment pages: « 1 2 3 4 [5] 6 »

Leave a Reply