| 开发者 | fahdchouki |
|---|---|
| 更新时间 | 2026年8月18日 19:08 |
| PHP版本: | 7.0 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
example.com/0, example.com/a, example.com/Z. A code only grows to two characters once every one character code is taken, and to three once every two character code is taken. That is 62 links at one character, 3,844 at two, 238,328 at three, and 14.7 million at four.
Codes that would clash with something real are skipped automatically, so a link is never handed out that WordPress cannot serve. That covers existing posts, pages and categories, the WordPress paths such as wp-admin and wp-json, feeds, common shop URLs, and any word you add yourself. Once a code is in use, WordPress is stopped from giving that slug to a post created later, so a link you have already shared cannot be taken away from you.
Built to be fast
A short link is answered on plugins_loaded, before the theme is loaded, before the main query runs and before a single block is registered. The whole request is one cached lookup and a redirect header. On sites with a persistent object cache such as Redis or Memcached, a repeat click does not touch the database at all.
Click statistics are written after the response has been handed back to the visitor, using fastcgi_finish_request() where the host supports it, so counting a click costs the visitor nothing.
One click in the editor
nano-urls/v1 with endpoints to create, list, read, update, delete and expand links, plus daily click counts. Authenticate with an API key issued on the plugin's API screen, an application password, or a logged in cookie with a nonce. Keys are stored as hashes and act with the permissions of the user they belong to.
There are template tags too, for use in themes and other plugins:
$short = nanourls_shorten( 'https://example.com/page' );
$short = nanourls_get_short_url( $post_id, true );
$target = nanourls_expand( 'a7' );
Privacy
This plugin makes no external connections of any kind. Click statistics are a running total and a count per day per link. No IP addresses, user agents, referrers or any other personal data are stored.
nano-urls folder to /wp-content/plugins/, or install the plugin through the Plugins screen in WordPress.No. Before a code is handed out it is checked against existing post slugs, category and tag slugs, files and folders in your web root, WordPress reserved paths and your own reserved word list. On top of that, when WordPress later tries to give a post a slug that matches a code already in use, the plugin nudges the post to a different slug so the shared link keeps working.
Yes. Set a path prefix such as s or go under Nano URLs → Settings and links become example.com/s/a7. Leaving it empty gives the shortest possible link, straight from the site root.
Yes, if you own a domain that points at this same WordPress install. Add it as the short domain in the settings and generated links use it. The plugin does not register or configure domains for you.
Yes. Every public post type is supported, products included. The Short URL column appears on the Products screen and the panel appears in the product editor.
Nothing breaks. Links attached to a post follow that post, and the stored destination is refreshed whenever the post is saved or republished.
Its short link is removed with it. Use the nanourls_delete_links_with_post filter if you would rather keep it.
Short codes are sequential by design, because that is what makes them short. Anyone who tries example.com/1, example.com/2 and so on will find your links. Do not use a short link as a secret. If you want codes that are harder to walk through, raise the minimum code length in the settings.
Path based short links need pretty permalinks. With plain permalinks the plugin still resolves example.com/?nu=a7, and the settings screen will tell you.
No. On ordinary page loads the plugin does one cached check on the request path and then gets out of the way. Admin assets load only on the screens that use them, and the REST controller is only loaded on REST requests.
Only if you ask for it. Tick "delete all data on uninstall" in the settings first. Otherwise your links and statistics survive a deactivate or delete.