WordPress powers over 40% of the web, and every WordPress site generates URLs that marketers need to share, track, and manage. You have three options for URL shortening on WordPress: rely on WordPress's built-in pretty permalinks, install a WordPress URL shortener plugin, or use an external URL shortener like Trunc with the API. Each approach has different trade-offs for analytics, control, and setup complexity.
Option 1: WordPress Pretty Permalinks (Built-In)
WordPress generates clean, readable URLs by default if you configure permalinks correctly. Under Settings → Permalinks, choose Post name to get URLs like yoursite.com/your-post-title instead of yoursite.com/?p=123. These are not short links — a typical post slug can be 40–60 characters — but they are human-readable and SEO-friendly. Pretty permalinks are a good baseline but do not give you click analytics or the ability to shorten links for social sharing.
Option 2: WordPress URL Shortener Plugins
Several WordPress plugins create short links directly on your domain. The most popular are Pretty Links and ThirstyAffiliates (designed for affiliate links). These create short links like yoursite.com/go/product-name that redirect to the destination URL. The advantage is that all short links use your own domain — good for branding. The disadvantage is that click analytics are basic, there is no AI insights or A/B testing, and the short links are only as fast as your WordPress hosting (which can be slower than a dedicated shortener's CDN).
| Plugin | Free Plan | Analytics | Custom Short Code | Own Domain |
|---|---|---|---|---|
| Pretty Links | Yes (limited) | Basic click counts | Yes | Yes (your WP domain) |
| ThirstyAffiliates | Yes (limited) | Basic | Yes | Yes (your WP domain) |
| Trunc (via API) | Yes (generous) | Full — geo, device, referrer | Yes | Premium plan |
Option 3: Trunc API with WordPress (Recommended for Marketers)
For WordPress sites where analytics matter — content marketing, affiliate sites, e-commerce — using the Trunc API gives you the best of both worlds: short links hosted on trunc.site (or your own custom domain on the Premium plan) with full click analytics including geographic data, device breakdown, referrer tracking, and AI insights. The Trunc API integrates with WordPress in two ways: via a custom PHP snippet in your theme's functions.php, or via WordPress's built-in HTTP API.
How to Integrate Trunc with WordPress (PHP Code)
Add this function to your WordPress theme's functions.php or a custom plugin to shorten URLs programmatically:
function trunc_shorten_url( $long_url ) { $response = wp_remote_post( 'https://trunc.site/api/v1/shorten', [ 'headers' => [ 'Authorization' => 'Bearer YOUR_API_KEY', 'Content-Type' => 'application/json', ], 'body' => wp_json_encode([ 'url' => $long_url ]), ]); if ( is_wp_error( $response ) ) return $long_url; $data = json_decode( wp_remote_retrieve_body( $response ), true ); return $data['short_url'] ?? $long_url; }
Call trunc_shorten_url( get_permalink() ) anywhere in your templates to generate a short link for the current post. You can use this in social sharing buttons, email newsletter templates, or anywhere you need a short, trackable link.
Using Trunc for WordPress Affiliate Links
Affiliate marketers running WordPress sites often use Pretty Links or ThirstyAffiliates to cloak affiliate URLs. Trunc provides a better alternative for external affiliate links (Amazon Associates, Commission Junction, ShareASale): shorter links, richer analytics, and the ability to update where a link points without changing the published URL. If a product you are promoting gets discontinued, you can redirect the Trunc short link to an alternative without editing hundreds of blog posts.
WordPress URL Shortener: Which Option is Right for You?
- For simple affiliate link cloaking on your own domain: Pretty Links or ThirstyAffiliates free tier.
- For full analytics and AI insights: Trunc via API (free plan, no WordPress plugin required).
- For branded short domains (yoursite.com/go/...): Pretty Links + your own domain, or Trunc Premium with custom domain.
- For bulk link management across multiple WordPress sites: Trunc dashboard — manage all links in one place regardless of where they were created.
Get your free Trunc API key and start tracking WordPress link clicks. No credit card required.
Get a Free API Key