WP-Mix

A fresh mix of code snippets and tutorials

Display short URLs in WordPress

Quick tip for the day: display short URLs using native WordPress functionality.

Just include the following code anywhere in the WordPress loop to display a short URL for the post:

<? php echo get_bloginfo('url'). "/?p=".$ post->ID; ?>

For each post or page, this will display a URL that looks like this:

https://wp-mix.com/?p=7

Easy peasy.

Learn more

 Digging Into WordPress WordPress Themes In Depth Wizard’s SQL Recipes for WordPress