WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Hum

Personal URL shortener for WordPress

Developer Documentation

Adding your Amazon Affiliate ID

If you'd like to include your Amazone Affiliate ID in the /i/ redirect URLs, implement the amazon_affiliate_id filter. For example:

add_filter('amazon_affiliate_id', create_function('', 'return "willnorris-20";'));

Additional Local Types

Out of the box, Hum only registers the b and t prefix to be served locally by WordPress. If you would like to register additional prefixes, implement the

hum_local_types

filter. For example, to include 'p' as well for photos:

function myplugin_hum_local_types( $types ) {
  $types[] = 'p';
  return $types;
}
add_filter('hum_local_types', 'myplugin_hum_local_types');

This will tell Hum to serve any /p/{id} URLs from WordPress. Additionally, you'll want to instruct Hum to use your prefix for that particular content type. Here, we're registering 'p' which is normally used for photos.

function myplugin_hum_type_prefix( $prefix, $post_id ) {
  $post = get_post( $post_id );

  if ( $post->post_type == 'attachment' &&
       strpos($post->post_mime_type, 'image') === 0 ) {
    $prefix = 'p';
  }

  return $prefix;
}
add_filter('hum_type_prefix', 'myplugin_hum_type_prefix', 10, 2);

Simple Redirect

You can redirect all traffic for a prefix using a single line of PHP my implementing the hum_redirect_base_{type} filter where {type} is the prefix to redirect. For example, I redirect all /w/ URLs to wiki.willnorris.com using:

add_filter('hum_redirect_base_w',
  create_function('', 'return "http://wiki.willnorris.com/";'));

Requires: 3.0 or higher
Compatible up to: 3.5.2
Last Updated: 2012-11-25
Downloads: 536

Ratings

3 stars
3 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.