wp_get_shortlink Wordpress function


Return a shortlink for a post, page, attachment, or blog.



(int) $id A post or blog id. Default is 0, which means the current post or blog.
(string) $context Whether the id is a 'blog' id, 'post' id, or 'media' id. If 'post', the post_type of the post is consulted. If 'query', the current query is consulted to determine the id and context. Default is 'post'.
(bool) $allow_slugs Whether to allow post slugs in the shortlink. It is up to the plugin how and whether to honor this.

Return Type:

(string) A shortlink or an empty string if no shortlink exists for the requested resource or if shortlinks are not enabled.

Define At:


Wordpress Reference URL:


0 Flares Facebook 0 Google+ 0 0 Flares ×
Posted in: Wordpress functions
0 Flares Facebook 0 Pin It Share 0 Google+ 0 0 Flares ×