BACK TO DIRECTORY




URL Shortener by Melk is a lightweight and efficient WordPress plugin that allows you to automatically generate short URLs for your posts, pages, categories, tags, and Custom Post Types. Ideal for sharing on social media and marketing materials.
Features:
- Automatic Generation: Automatically creates short URLs when publishing new posts.
- Comprehensive Support: Works with Posts, Pages, Categories, Tags, and Custom Post Types.
- Quick Copy: “Copy” button directly in the post/term listing in the admin panel.
- Bulk Generation: Tool to generate short URLs for old content with one click.
- Performance: Fast redirection resolved only on would-be 404s (no heavy queries), so your pages and posts are never affected.
- Secure: Validated and secure code, following WordPress best practices.
Developer Notes
- Namespace:
Melk\\UrlShortenerByMelk. - Unique prefix: all functions, options, meta keys and hooks use the
urlshbym_prefix, following the WordPress Plugin Handbook recommendations to avoid naming collisions. - Options stored in the database:
urlshbym_enabled_post_typesurlshbym_enabled_taxonomies
- Meta keys:
_urlshbym_short_codeon posts_urlshbym_short_codeon terms (taxonomies)
- Database table:
{$wpdb->prefix}urlshbym_short_urlsis created on activation to store the mapping between short codes and objects. - Main hook:
urlshbym_short_url_clicked— fired whenever a short URL is accessed, receiving the short code and the internal record ID.
- Integration helper:
urlshbym_get_short_url_for_post( $post_id )— a global function other plugins (such as Social Kit by Melk) can call viafunction_exists()to reuse the short URL, with no hard dependency in either direction. - Resolution: on
template_redirect(priority 1), only when the main query is a 404, a root-level path of 5-7 alphanumeric characters is looked up in the table and redirected with a 301. No rewrite rules are registered. - Options also stored:
urlshbym_delete_data_on_uninstall,urlshbym_db_version.
Screenshots

Admin settings page where you can choose post types and taxonomies.

Quick copy button in the posts list table.

Bulk generation tool for existing content.
Plugin Details
Active Installs
0Total Downloads
470Version
1.0.1Requires WP
5.0Requires PHP
7.4Tested Up To
7.1.4Added
2026-01-26Last Updated
2026-10-08 5:02pm GMTRatings
5
0
4
0
3
0
2
0
1
0