跳到内容

Shortlinks

v0.1

aizatto · 2010年4月15日 上架

Shortlinks allows you to easily retrieve the shortlink for your WordPress posts, pages, categories, post_tags, attachments, custom post types, and cus …

正在使用
10+
评分
5.0 / 5
累计下载
3,921
最近更新
2010年4月15日
1 条评价需要 WordPress 3+已测试到 3

贡献者

截图

Easily get shortlinks for posts
Easily get shortlinks for posts
Easily get shortlinks for pages
Easily get shortlinks for pages
Easily get shortlinks for a single page
Easily get shortlinks for a single page
Easily get shortlinks for categories
Easily get shortlinks for categories

Shortlinks allows you to easily retrieve the shortlink for your WordPress posts, pages, categories, post_tags, attachments, custom post types, and custom taxonmies.

By default, WordPress uses links a query string ( ie: http://blog.aizatto.com/?page_id=3565 ) to load up your posts, pages, categories, etc. But when you enable permalinks, the query string is hidden by the WordPress rewrite rules. Having pretty urls is great, but also makes the website less flexible. For example, changing a posts published date will change the URL.

While we can’t control how other people will link to our site, we can control how we link to our internal sites.

By default, with permalinks enabled, when visiting WordPress with a shortlink, WordPress will redirect you to the permalink URL.

How It Works

Shortlinks hooks into the WordPress filter get_shortlink to enable shortlinks for all WordPress types.

You can use Shortlinks in your own theme or plugin.

To return the shortlink for a post, page, or custom post type, where $id represents the ID:

To return the shortlink for a category, where $id represents the category id:

To return the shortlinks for custom taxonomy, where $id represents the term id, and $taxonomy represents the custom taxonomy:

Why I Created It

WordPress supports shortlinks by default, but only allows the user to get the shortlink for a post. Finding it unacceptable, I created a plugin to get shortlinks for all content types.

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums