Good plugin for managing outbound links? [closed]

I can think of two methods to accomplish this, either would be equally valid. I will cover the pros and cons of each at the end of the explanation for them.

  1. Use a Shortcode

    Define a shortcode, say [wpse47706_link]. You will probably want to give it an href attribute. Use this for every single link on your site, internal and external. When you go to output the actual text, parse the url (parse_url()) and get the hostname. Compare this to the site url. If it matches, apply one set of rules, otherwise apply another. You could control these from your dashboard if you felt so compelled (that’s settings API, a whole different topic).

    pros

    • efficient with resources
    • global control is easy

    cons

    • does not afford individual control
    • control over links from varying regions could become tricky, especially if you want to dynamically generate the settings areas
  2. Parse the site’s content

    By parsing the content of the entire site, you can get every link on the site. You would have to figure out what you do and don’t want to parse, and probably do a lot of background work…which could become rather unpleasant. When you have all the content of the site, parse it for links (with a regex) and output these. Due to the method by which they are gotten it will be relatively simple to organize them by location on the site, even down to the level of links in an individual post or widget. Once you have gotten all of these, you can modify them (and then subsequently overwrite them in the source) to your liking. This could be done from some sort of admin interface with checkboxes and such, or programatically based on a set of rules you define.

    pros

    • much finer control, down to the individual link level
    • output of links is more efficient (since it requires no PHP, as the modifications are made directly to the db)

    cons

    • directly modifying content (generally a bad idea)
    • if you have lots of links, the UI could become difficult to manage
    • I can imagine the load for the management page becoming rather heavy
    • The changes could be overwritten by an author
    • does not allow control over links not stored in the db (whereas, through do_shortcode(), the other method does)

Hopefully this has given you something to consider…neither is really an outstanding option, but I wouldn’t say either is bad. Personally I would go with the shortcode, but that’s me.