[wp-trac] [WordPress Trac] #10640: Support "shortlink" URL shortening

WordPress Trac wp-trac at lists.automattic.com
Sat Dec 26 14:22:11 UTC 2009


#10640: Support "shortlink" URL shortening
-----------------------------+----------------------------------------------
 Reporter:  samj             |        Owner:          
     Type:  feature request  |       Status:  reopened
 Priority:  normal           |    Milestone:  3.0     
Component:  General          |      Version:          
 Severity:  normal           |   Resolution:          
 Keywords:  needs-patch      |  
-----------------------------+----------------------------------------------
Changes (by Denis-de-Bernardy):

  * keywords:  dev-feedback => needs-patch


Comment:

 @Jane: after re-reading the thread, I think the following *could* be an
 option:

 {{{
 function get_the_short_link($id = null) {
   // 1. use current post $id if none is supplied, as we do for permalinks

   // 2. fetch short_link, i.e. domain.com/?p=123 or /?page_id=456 or...

   return apply_filters('the_short_link', $short_link, $id);
 }

 function the_short_link($id = null) {
   $short_link = get_the_shortlink($id);
   if ( $short_link )
     echo '<link rel="shortlink" href="' . esc_url($short_link) . '" />';
 }
 }}}

 and perhaps another function to send the needed header.

 in other words, the default would be that non-fancy permalinks are
 shortlinks in their own right (which they are), and WP would expose an API
 that plugins can use so they don't interfere with each other in the event
 that several such plugins are active.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10640#comment:22>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list