{$action}_overrides

过滤钩子


apply_filters( "{$action}_overrides", $overrides, $file )
参数
  • (array|false)
    $overrides
    An array of override parameters for this file. Boolean false if none are
    provided. @see _wp_handle_upload().
    Required:
  • (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:
定义位置
  • wp-admin/includes/file.php
    , line 829
引入
5.7.0
弃用

在文件上传到WordPress之前,对文件的覆盖参数进行过滤。

钩子名称的动态部分, $action,是指文章的动作。

可能的钩子名称包括:

  • wp_handle_sideload_overrides
  • wp_handle_upload_overrides
$overrides = apply_filters( "{$action}_overrides", $overrides, $file );