Every WordPress site adds a shortlink tag to the site header by default, showing a shortened URL like domain.com/?p=123 for every post and page. If your site already uses clean, readable permalinks, this tag serves no real purpose and just adds unnecessary code to your pages.
What the Shortlink Tag Actually Is
By default, WordPress inserts a link rel="shortlink" tag into the <head> of every page and post, along with a matching entry in the HTTP response header. Sites using pretty permalinks, meaning readable URLs like domain.com/post-name instead of domain.com/?p=123, generally have no use for this shortened version, since it isn’t required for SEO and doesn’t improve how the page functions for visitors.
Removing It With Code
For anyone comfortable editing their theme’s functions.php file, the shortlink can be removed with a short code snippet. This removes both the tag from the page header and the corresponding entry from the HTTP response header:
add_filter('after_setup_theme', 'remove_wp_shortlink');
function remove_wp_shortlink() {
remove_action('wp_head', 'wp_shortlink_wp_head', 10);
remove_action('template_redirect', 'wp_shortlink_header', 11);
}
Add this to your child theme’s functions.php file so the change survives future theme updates. If you only want to remove the tag from the page’s visible source and don’t need to touch the HTTP header version, a single line will do the job on its own:
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
Removing It Without Editing Code
Not everyone wants to touch theme files directly, and there are a couple of simpler paths for that. Several performance-focused plugins, including Perfmatters and Perform, include a built-in “Remove Shortlink” toggle that handles both the header tag and the HTTP response header without any manual coding. Similarly, free plugins built specifically for cleaning up the WordPress head section — like UltimaKit’s shortlink module — offer the same one-click removal.
Why Some Sites Keep the Shortlink
Removing the shortlink is safe for most modern WordPress sites, but it’s worth understanding what it’s for before disabling it. The shortlink exists mainly to provide a stable, short URL for sharing posts, which mattered more in the early days of link shorteners and character-limited social platforms. Since pretty permalinks now serve the same purpose for most sites, and shareable short URLs are usually handled by dedicated link-shortening services when needed, the built-in shortlink tag has become largely redundant for the average site.
A Few Things to Check Before Removing It
Before stripping the shortlink out entirely, it’s worth a quick check to make sure nothing on your site actually relies on it:
- Confirm no theme features, plugins, or custom scripts reference the shortlink URL structure
- If you’re using an SEO plugin, check its settings first, since some SEO tools add or manage the shortlink tag themselves rather than WordPress core
- Test the change on a staging site if your workflow allows it, especially if you’re editing
functions.php directly
Join The Discussion
Have you removed the shortlink tag from your own WordPress site, or found it useful for something specific? Share your experience, any plugins that worked well for you, or questions about cleaning up your site’s head section below.