內容簡介
Basic URL ShortCodes 外掛讓使用者能夠在內容編輯器中輕鬆插入重要的 WordPress URL,透過簡單的短碼來顯示網站的基本 URL、主題 URL 或上傳資料夾 URL,提升內容管理的便利性。
【主要功能】
• 支援多種短碼顯示重要 URL
• 短碼可附加路徑參數以構建完整 URL
• 提供安全的 URL 輸出,避免指向外部網站
• 短碼前綴避免與其他外掛衝突
• 完全兼容現代 WordPress 編輯器
外掛標籤
開發者團隊
原文外掛簡介
Sometimes you need to display your website’s base URL, active theme URL or uploads folder URL directly inside your content editor.
Basic URL Shortcodes lets you insert important WordPress URLs using simple shortcodes inside posts, pages and widgets. Every shortcode accepts an optional path attribute so you can build a full URL in one go, and the output is escaped for you.
Available Shortcodes
[home_url]
The website’s home URL, as set in WordPress Settings.
Example: http://localhost/wp-demo
[site_url]
The URL where WordPress itself is installed. This differs from [home_url] when WordPress lives in a sub-directory.
Example: http://localhost/wp-demo/wp
[theme_url_template]
The URL of the currently active theme. Child themes are supported and return the child directory.
Example: http://localhost/wp-demo/wp-content/themes/mytheme
[parent_theme_url]
The URL of the parent theme, even when a child theme is active.
Example: http://localhost/wp-demo/wp-content/themes/parenttheme
[UPLOAD_URL] (also available as [upload_url])
The base URL of the WordPress uploads directory.
Example: http://localhost/wp-demo/wp-content/uploads
[content_url]
The URL of the wp-content directory.
[plugins_url]
The URL of the plugins directory.
[admin_url]
The URL of the WordPress admin area.
Example: [admin_url path="options-general.php"]
[rest_url]
The base URL of the REST API.
Example: [rest_url path="wp/v2/posts"]
[login_url] and [logout_url]
Login and logout URLs, with an optional redirect attribute.
Example: [login_url redirect="http://localhost/wp-demo/account"]
[current_url]
The full URL of the page currently being viewed, query string included.
Attributes
path — appended to the URL. Works on every shortcode except `[login_url]`, `[logout_url]` and `[current_url]`.
Example: [home_url path="contact"] outputs http://localhost/wp-demo/contact
For safety, a path that starts with a scheme (http:), a protocol-relative prefix (//) or a backslash is ignored, so a shortcode can never be used to point at another site.
esc — set to `raw` to skip HTML entity encoding when the value is consumed by JavaScript rather than an `href`. Defaults to `html`.
Example: [home_url esc="raw"]
redirect — where to send the visitor after login or logout. Off-site targets are rejected.
Prefixed aliases
Short tags such as [home_url] are generic and another plugin may already own them. Every shortcode is therefore also registered with a burl_ prefix — [burl_home_url], [burl_upload_url], and so on — which is guaranteed not to clash. If a tag is already taken by another plugin, this plugin leaves it alone rather than overriding it.
These shortcodes are useful when building custom layouts, inserting dynamic links or when theme customization options are limited.
Lightweight, simple and fully compatible with modern WordPress editors.
License
This plugin uses the GPLv3 license.
