I spent a lot of time discussing WordPress 3.1 at last night’s Montreal developer_meetup(), and someone brought up a great point about the new internal linking feature. As it stands, the feature allows you to easily add a link to any post or page within your database. All you need to do is highlight some text in the Visual editor and click on the Link button. The new internal linking popup will appear. It looks a lot like this:
You can search for a post/page or just scroll down through every entry. Click on one and it’s title and URL appear in the URL and TITLE input field. Click “Add Link” and voila! The point someone made, was that it actually adds an absolute URL using a typical anchor tag, so changing the permalinks setting, or your domain, or even the location of your site would automatically break all internal links within your posts. A solution I came up with, was to use a shortcode instead of typical HTML.
The shortcode would just have to use the
$post->ID to call the permalink, which would adjust according to your permalinks setting, your site URL and your post/page slug. Every element could be changed and the link would still work.
I’m going to suggest this one and see if it makes it into the release. If not, expect a plugin after 3.1 comes out.