Smart Links Plugin For WordPress

The smart link plugin for WordPress lets you insert links using natural language rather than urls.


<a href="">



The resulting increase in usability is quite significant.

A Few Words On Autolink Plugins…

… since this was the initial idea behind smart links.

There are several autolink plugins around. aLinks is one of the better ones, if this is what you’d like to be using. They invariably suffer from one or two niggles:

  1. They’re too systematic: If your keyword shows 10 times in a text, it’ll get linked 10 times.
  2. There are time where it makes more sense to add a keyword link on an entire key phrase, and autolink plugins don’t allow this.

Smart links’ flexibility lets you work around both niggles.

Default Usage

The Basics

Using smart links, you insert links using an arrow in between brackets (the same syntax as the one used on several established newspaper websites):

[link text->link]

For instance, if you’re linking to a page called “dog training tips”, you could end up writing:

[teach your puppy to sit->dog training tips]

The syntax is permissive: It’s case insensitive and impervious to extra spaces.

If your link text is the same as the link, you can simply close the bracket after the arrow:

[dog training tips->]

For reference, the syntax also works with normal urls and emails:


Also for reference, “slugs” (the sanitized versions of titles that show in the url) work too:

[teach your puppy to sit->dog-training-tips]

These basics in mind, let’s hop to how they can become useful for SEO and site maintainability purposes.

How Smart Links Come In Handy

Smart links are useful in that they let you pre-insert links in your site.

The links get silenced when no relevant piece of information is found. They then mutate as the site evolves, in order to point to the most worthy piece of information at all time.

Suppose that you’re starting a dog training blog.

During the first week, you add a few posts and add smart links to “dog training tips”. You know you’ll eventually write about this explicitly, so you might as well add the links as you create the posts.

Shortly after, you spend some time adding a bunch of bookmarks in the link manager. One of them is called “Dog Training Tips”. The smart links, which were silenced until now (they were returning the text with no link), now point to the bookmark you’ve just entered.

You update the bookmark (you change it’s url to a better site you’ve just found) the next day, and the site updates without your even worrying about it.

Eventually, you write a post titled “Dog Training Tips” — and add a smart link to “Dog Training Tips” in it. The old posts are now pointing to this post instead, and the smart link in this post is pointing to your bookmark.

A week later, you write a new post called “Dog Training Tips”. The smart links are now all pointing to this new post — because it is more recent than the first one.

At last, you create a section — a static page — called “Dog Training Tips”, with a smart link to “Dog Training Tips” in it. All of the smart links are now pointing to this static page. The only exception is the “Dog Training Tips” smart link on that page, which is pointing to your bookmark.

If, upon revisiting your site a year later, you decide to turn the “Dog Training Tips” section into a subsection of “Dog Training”, smart links will update themselves and point to the static page’s new url.

In other words:

  1. Smart Links seek to return a link to the bookmark with the same name.
  2. When posts with the same title exist, Smart Links will point to the most recent post instead.
  3. When a static page with the same title exists, Smart Links will point to that static page instead.
  4. On the post or static page that is supposed to get linked to, smart links will try to fallback to a bookmark (there’s no point in linking a web page to itself).
  5. When all else fails, Smart Links return the link text with no link.

Got it all so far? Onto smart link domains.

Advanced Usage

Smart Link Domains

Domains are areas where smart links scan are for relevant pieces of information. By default, smart links looks all over the place. But you can restrict smart links to certain domains, by using the following syntax:

[link text->link @ domain]

Implicit links work here as well:

[roll over->@ dog tricks]

Built-in domains include those related to WordPress:

  • posts
  • pages
  • entries (posts and pages)
  • links
  • wp (all of the above = the default domain)

For instance, you could write:

[teach your puppy to sit->dog training tips @ pages]

The above smart link would get silenced until you create a dog training tips page.

Other built-in domains include:

  • google
  • yahoo
  • msn
  • wiki

These create outbound links to the search queries on google, yahoo, msn, and wikipedia respectively.

The last set of built-in domains is dynamic. They let you restrict smart links to a section on your site.

Smart Links understands sections as static pages with no parents. When you use a section domain, only links to static pages within that section will be returned.

On, for instance:

  • [services->@services] would point to the services section
  • [services->@members] would point to a services page of the members’ area

These dynamic domains become tremendously useful when you start having multiple static pages with the same name on your site. Or when you wish to fine-tune where the smart links are pointing.

Text-Rendering Engine Transparency

The smart link syntax is transparent to Markdown and Textile syntax, but will not allow html code within smart links.

Class Attribute

If you want to add a class="external" attribute to outbond smart links, you need to use the external links plugin.

Title Attribute

Smart links use the page title, post title, category name, and link name as relevant.

Smart Link And Comments

Smart links are disabled in comments, to prevent spammers from bypassing anti-spam plugins.

Escaping Smart Links

You can escape the smart link by putting it in between backticks (`), e.g.:

  • `[escape the link->]` outputs:
    [escape the link->]

The backticks will be “used up” when the smart links are processed.

Smart Link Greediness

The smart link syntax is not greedy, e.g.:

  • [test1 [test2->/] ->/] outputs:
    [test1 test2 ->/]

Smart Link Plugins

If you feel like coding, you can register new smart link domains, like this:

smart_links::register_engine($domain, $callback);

The expected signature of domain handling callback functions is the following:

domain_engine($link) returns $links
  • $links is an array($look_for => $found)
  • $look_for is the reference that is looked for
  • $found is of course initialized to false


This package is part of Semiologic Pro, and is access-restricted.

Bleeding Edge Zip

Frequently Asked Questions


The Semiologic forum is the best place to report issues.

Change Log

Version 4.8 =

  • Fix a bunch of missed static/non-static php calling warnings that got missed
  • WP 4.3 compat
  • Tested against PHP 5.6

Version 4.7 =

  • WP 4.0 compat

Version 4.6.1 =

  • Clear internal cache upon WP upgrade

Version 4.6 =

  • Code refactoring
  • WP 3.9 compat

Version 4.5.1 =

  • Further tweaks around the widget context caching

Version 4.5 =

  • Improved context caching to work better with page revisions and auto-saves.
  • WP 3.8 compat

Version 4.4.1 =

  • Fix missing static designator in PHP code

Version 4.4 =

  • WP 3.6 compat
  • PHP 5.4 compat

Version 4.3.1 =

  • Fix caching issue with "This Page in Widgets" not refreshing on title or description updates

Version 4.3 =

  • WP 3.5 compat
  • Updated for Bing

Version 4.2.4 =

  • WP 3.0 compat

Version 4.2.3 =

  • Avoid using broken WP functions

Version 4.2.2 =

  • Cache improvements
  • Apply filters to permalinks
  • Give more prominence to a page's immediate children

Version 4.2.1 =

  • Fix erratic behavior when scanning for domain-less pages
  • WP 2.9 compat

Version 4.2 =

  • Complete rewrite
  • Localization
  • Code enhancements and optimizations