[WordPress] 外掛分享: Clear Media Title On Upload

首頁外掛目錄 › Clear Media Title On Upload
WordPress 外掛 Clear Media Title On Upload 的封面圖片
全新外掛
安裝啟用
尚無評分
47 天前
最後更新
問題解決
WordPress 6.0+ PHP 7.4+ v2.0.1 上架:2026-01-26

內容簡介

**總結:**
當您將媒體上傳至WordPress時,標題欄位會自動設定為檔名的轉換版,通常會產生雜亂、未最佳化的標題。這款外掛會清除新上傳媒體的標題欄位,確保若有任何標題顯示,都是您自行設定的。

**問題與回答:**
1. 外掛的主要功能是什麼?
- 答: 自動清除新媒體上傳的標題欄位。

2. 如何讓外掛對現有媒體庫項目的標題進行批量操作?
- 答: 透過批量動作來清除現有媒體庫中的標題。

3. 外掛是否涵蓋了設定頁面?
- 答: 外掛是輕量的,且無需設定頁面。

4. 外掛是否開發者友善?
- 答: 是的,外掛具備過濾器,開發者可以使用這些過濾器進行相應操作。

外掛標籤

開發者團隊

⬇ 下載最新版 (v2.0.1) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Clear Media Title On Upload」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

When you upload media to WordPress, the title field is automatically set to a slugified version of the filename. This often results in messy, unoptimized titles like “IMG-20240115-photo-final-v2” appearing in gallery captions, alt tags, or title attributes.
This plugin clears the title field for newly uploaded media, ensuring that if a title is displayed anywhere, it’s one you’ve intentionally set yourself.
Features

Automatically clears the title field for new media uploads
Bulk action to clear titles on existing media library items
Lightweight with no settings page required
Developer-friendly with filters

How It Works
The plugin hooks into WordPress’s wp_insert_attachment_data filter and clears the post_title field for new uploads before they are saved to the database.
Filters
runthings_emt_skip
Skip clearing the title for specific attachments.
Parameters:

$skip (bool) – Whether to skip clearing the title. Default false.
$data (array) – Attachment post data (slashed, sanitized, processed).
$postarr (array) – Sanitized post data (not processed).
$unsanitized_postarr (array) – Unsanitized post data.
$update (bool) – Whether this is an update (always false for new uploads).

Example:
// Skip clearing title for uploads by specific user
add_filter('runthings_emt_skip', function($skip, $data, $postarr) {
if (get_current_user_id() === 1) {
return true; // Admin keeps auto-generated titles
}
return $skip;
}, 10, 3);

// Skip clearing title if filename contains "keep-title"
add_filter('runthings_emt_skip', function($skip, $data, $postarr) {
$filename = $postarr['post_title'] ?? '';
if (strpos($filename, 'keep-title') !== false) {
return true;
}
return $skip;
}, 10, 3);

runthings_emt_mime_types
Filter which MIME types should have their title cleared. By default, all media types are affected.
Parameters:

$allowed_mime_types (array) – Array of MIME type patterns. Default [] (all types).
$attachment_mime_type (string) – The attachment’s MIME type.
$postarr (array) – Sanitized post data.

Example:
// Restrict to images only
add_filter('runthings_emt_mime_types', function($allowed_mime_types) {
return ['image'];
});

// Restrict to images and PDFs only
add_filter('runthings_emt_mime_types', function($allowed_mime_types) {
return ['image', 'application/pdf'];
});

Additional Notes
Built by Matthew Harris of runthings.dev, copyright 2022-2026.
Visit runthings.dev for more WordPress plugins and resources.
Contribute or report issues at the GitHub repository.
Insert space by Xinh Studio from Noun Project, https://thenounproject.com/browse/icons/term/insert-space/ (CC BY 3.0) – https://thenounproject.com/icon/insert-space-239543/
Image by David Khai from Noun Project, https://thenounproject.com/browse/icons/term/image/ (CC BY 3.0) – https://thenounproject.com/icon/image-661355/

延伸相關外掛

文章
Filter
Apply Filters
Mastodon