
內容簡介
總結:URL Shortener by Melk 是一個輕量且高效的 WordPress 外掛,可自動為您的文章、頁面、分類、標籤和自訂文章類型生成短網址,非常適合在社交媒體和行銷材料中分享。
問題與答案:
1. 這個外掛可以自動生成短網址的時機是?
- 答:在發佈新文章時會自動生成短網址。
2. 這個外掛支援的內容類別有哪些?
- 答:它支援文章、頁面、分類、標籤以及自訂文章類型。
3. 有沒有快速複製短網址的功能?
- 答:有,使用者可以直接在後台中的文章/項目列表中按一個"複製"按鈕。
4. 這個外掛有批量生成短網址的工具嗎?
- 答:有,它提供工具可以一鍵生成舊內容的短網址。
5. 短網址的重定向速度如何?
- 答:它使用本機 WordPress 重寫規則實現快速重定向,不需要繁重的查詢。
6. 這個外掛的程式碼是否安全?
- 答:是的,它經過驗證並具有安全的程式碼,遵循 WordPress 最佳實踐。
外掛標籤
開發者團隊
原文外掛簡介
URL Shortener by Melk is a lightweight and efficient WordPress plugin that allows you to automatically generate short URLs for your posts, pages, categories, tags, and Custom Post Types. Ideal for sharing on social media and marketing materials.
Features:
Automatic Generation: Automatically creates short URLs when publishing new posts.
Comprehensive Support: Works with Posts, Pages, Categories, Tags, and Custom Post Types.
Quick Copy: “Copy” button directly in the post/term listing in the admin panel.
Bulk Generation: Tool to generate short URLs for old content with one click.
Performance: Fast redirection using native WordPress rewrite rules (no heavy queries).
Secure: Validated and secure code, following WordPress best practices.
Developer Notes
Namespace: Melk\\UrlShortenerByMelk.
Unique prefix: all functions, options, meta keys and hooks use the urlshbym_ prefix, following the WordPress Plugin Handbook recommendations to avoid naming collisions.
Options stored in the database:
urlshbym_enabled_post_types
urlshbym_enabled_taxonomies
Meta keys:
_urlshbym_short_code on posts
_urlshbym_short_code on terms (taxonomies)
Database table: {$wpdb->prefix}urlshbym_short_urls is created on activation to store the mapping between short codes and objects.
Main hook:
urlshbym_short_url_clicked — fired whenever a short URL is accessed, receiving the short code and the internal record ID.
Rewrite rules: short URLs are handled through a rewrite rule that maps patterns like /abc12 to index.php?urlshbym_short=abc12.
