G2A Many GEOs
SHARE
TWEET

Set WordPress shortlink to siteurl.com/1234

TourKick Dec 12th, 2012 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // By Clifford Paulick of http://tourkick.com/
  2. //
  3. // RESULTS IN SETTING http://siteurl.com/1234 AS THE SHORTLINK
  4. //
  5. // MAKE SURE YOU ENABLE THESE LINKS TO WORK VIA SOME METHOD, like http://managewp.com/?p=377184
  6. //
  7. function post_id_shortlink() {
  8. global $post;
  9.         if ( is_singular() ) {
  10.                 $postid = $post->ID;
  11.                         $idshortlink = site_url() . '/' . $postid;
  12.                         return $idshortlink;
  13.                 }
  14.         }
  15. add_filter( 'pre_get_shortlink', 'post_id_shortlink', 99); // priority 99 overrides bit.ly and other plugin's default priority of 10
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top