{$action}_prefilter

過濾鉤子
apply_filters( "{$action}_prefilter", $file )
引數
  • (array) $file { Reference to a single element from `$_FILES`. @type string $name The original name of the file on the client machine. @type string $type The mime type of the file, if the browser provided this information. @type string $tmp_name The temporary filename of the file in which the uploaded file was stored on the server. @type int $size The size, in bytes, of the uploaded file. @type int $error The error code associated with this file upload. }
    Required:
定義位置
相關勾子
admin_footertranslations_api_resultauthor_rewrite_rulesedit_profile_urlatom_entry
相關方法
option_update_filterdo_action_deprecateddoing_filterdo_action_ref_arraydid_filteradd_filter
引入
4.0.0
棄用
-

{$action}_prefilter是一個過濾鉤子,允許外掛在被$action指定的核心函式處理之前修改或過濾資料。與{$action}_overrides類似,這個鉤子允許外掛在核心函式處理之前修改資料。

在檔案被上傳到WordPress之前,對檔案的資料進行過濾。

鉤子名稱的動態部分,$action,指的是文章動作。

可能的鉤子名稱包括:

  • wp_handle_sideload_prefilter
  • wp_handle_upload_prefilter
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$file = apply_filters( "{$action}_prefilter", $file );
$file = apply_filters( "{$action}_prefilter", $file );
$file = apply_filters( "{$action}_prefilter", $file );

常見問題

FAQs
檢視更多 >