WordPress plugin which enables shortlinks for posts and pages based on their ID (i.e. http://example.com/123)
Switch branches/tags
Nothing to show
Clone or download
Failed to load latest commit information.
README.md Update author URL May 26, 2014
numeric-shortlinks.php Make sure that this is not a paginatad request Jul 30, 2014


Numeric Shortlinks for WordPress

A plugin which enables shortlinks for posts and pages based on their ID (i.e. http://example.com/123).

This plugin doesn't have any configuration options. It automatically hooks into the wp_get_shortlink() function and adds the new URL both in HTML <head> and any plugin that relies on shortlink functionality.

Prefer even shorter apha-numeric shortlinks?

This plugin allows you to choose between numeric shortlinks that are an exact match of the post ID, or use the alpha-numeric version for even shorter links.

Simply set the numeric_shortlinks_bijection filter to true, like so:

add_filter( 'numeric_shortlinks_bijection', '__return_true' );

Available Filters


Create your own mapping to post ID. Used when creating a shortlink.

add_filter( 'numeric_shortlinks_encode', 'my_shortlink_encode' );

function my_shortlink_encode( $post_id ) {
	// Do something to $post_id
	// The resulting URL will be http://example.com/$post_id
	return $post_id;


Map the trailing part of URL to post ID. Used when resolving a shortlink.

add_filter( 'numeric_shortlinks_decode', 'my_shortlink_decode' );

function my_shortlink_decode( $slug ) {
	// Convert $slug to a numeric $post_id
	return $slug;


Created by Kaspars Dambis: