
內容簡介
WordPress 預設只允許在撰寫文章或頁面時的下拉選單選擇欄位中列出 30 個自訂欄位名稱或鍵值。如果您或您使用的外掛使用大量自訂欄位鍵名稱,您可能會超過預設限制,導致一些自訂欄位鍵無法列出。這可能會迫使文章作者手動輸入自訂欄位鍵名稱,增加命名錯誤(打錯字或沒有使用所需的精確鍵名)的機會。這也可能會使一些作者擔心,擔心先前使用的自訂欄位鍵名稱被刪除,因為它們未被列出。
此外掛可以增加一次性至 200 個自訂欄位鍵名稱的預設限制。
沒有設定頁面可自訂預設值。如果您想列出一些與 200 不同的自訂欄位鍵名稱(例如 100),您可以用其中的任一方式:
編輯 wp-config.php 檔案,在最後面加上類似如下的一行:
define('CUSTOM_FIELD_NAMES_LIMIT', 100);
-或-
在 mu-plugin 或站點特定外掛或活動佈景主題的 functions.php 檔案中,或者不太理想的是不活動佈景主題的 functions.php 檔案中,使用 ‘c2c_list_more_custom_field_names’ 過濾器,返回您想使用的數量:
add_filter( 'c2c_list_more_custom_field_names', function( $limit ) { return 100; } );
注意:此外掛不會對使用自 WordPress v5.0 引入的區塊編輯器(又名 Gutenberg)的使用者產生影響,因為該編輯器沒有直接在介面上顯示自訂欄位。
連結:外掛首頁 | 外掛目錄頁面 | GitHub | 作者首頁
外掛標籤
開發者團隊
② 後台搜尋「List More Custom Field Names」→ 直接安裝(推薦)
📦 歷史版本下載
原文外掛簡介
By default, WordPress only allows 30 custom field names/keys to be listed in the dropdown selection ‘Name’ field when writing a post or page. If you, or the plugins you use, make use of a lot of custom field key names, you may surpass the default limit resulting in some custom field keys not being listed. This may force post authors to manually type in custom field key names if they aren’t listed, which increases the chances for naming errors (typos, or not using the precise key name that is needed). This may also cause some authors concern wondering where previously used custom field keys have gone since they aren’t listed.
This plugin increases the limit to 200 custom field key names.
There is no settings page to customize the default value. If you’d like to list some number of custom field key names other than 200 (say, for example, 100), you can do so in either of two ways:
By editing your wp-config.php file and at the end adding a line such as:
define( ‘CUSTOM_FIELD_NAMES_LIMIT’, 100 );
-or-
Somewhere — ideally in a mu-plugin or site-specific plugin, or less ideally your active theme’s functions.php file — hook the ‘c2c_list_more_custom_field_names’ filter and return the number you’d like to use:
add_filter( ‘c2c_list_more_custom_field_names’, function ( $limist ) { return 100; } );
Note: This plugin has no effect for users who make use of the block editor (aka Gutenberg) introduced in WordPress v5.0 because that editor does not directly expose custom fields in the interface.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
