Title: Get Shortened Permalink Functionality
Last modified: September 14, 2022

---

# Get Shortened Permalink Functionality

 *  Resolved [WP CMS Ninja](https://wordpress.org/support/users/billiardgreg/)
 * (@billiardgreg)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/get-shortened-permalink-functionality/)
 * Is there a way to get the shortened permalink that is auto assigned to a specific
   post by using the post ID via PHP?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [WP CMS Ninja](https://wordpress.org/support/users/billiardgreg/)
 * (@billiardgreg)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/get-shortened-permalink-functionality/#post-16010848)
 * So I didn’t want to wait around for the author to respond to the ticket so I 
   decided to write my own. Maybe the author will have a better way but here is 
   my solution.
 *     ```
       function get_pretty_link_url( $post_id ) {
           $pretty_link_id = get_post_meta($post_id, '_pretty-link', true);
           $url = prli_get_pretty_link_url($pretty_link_id);
           return $url;
       }
       ```
   
 * Hope this helps other people.
 *  [Krista](https://wordpress.org/support/users/kristathecoder/)
 * (@kristathecoder)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/get-shortened-permalink-functionality/#post-16044402)
 * Yes, this is probably the easiest and most direct way to get the pretty link 
   id from the post id.
 * I’ve also put in a feature request with our development team to add a helper 
   function for this to make it easier in the future.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Get Shortened Permalink Functionality’ is closed to new replies.

 * ![](https://ps.w.org/pretty-link/assets/icon-256x256.png?rev=2503434)
 * [PrettyLinks - Affiliate Links, Link Branding, Link Tracking, Marketing and Stripe Payments Plugin](https://wordpress.org/plugins/pretty-link/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pretty-link/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pretty-link/)
 * [Active Topics](https://wordpress.org/support/plugin/pretty-link/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pretty-link/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pretty-link/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Krista](https://wordpress.org/support/users/kristathecoder/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/get-shortened-permalink-functionality/#post-16044402)
 * Status: resolved