{$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
$file = apply_filters( "{$action}_prefilter", $file );

常见问题

FAQs
查看更多 >