钩子文档

oembed_min_max_width

💡 云策文档标注

概述

oembed_min_max_width 过滤器用于调整 oEmbed 响应的允许最小和最大宽度,默认值为最小 200 像素、最大 600 像素。

关键要点

  • 过滤器名称:oembed_min_max_width
  • 参数:$min_max_width 数组,包含 'min' 和 'max' 键,分别表示最小和最大宽度
  • 默认值:最小宽度 200,最大宽度 600
  • 引入版本:WordPress 4.4.0

代码示例

$min_max_width = apply_filters(
    'oembed_min_max_width',
    array(
        'min' => 200,
        'max' => 600,
    )
);

注意事项

  • 此过滤器在 get_oembed_response_data() 函数中使用,位于 wp-includes/embed.php 文件中
  • 开发者可以通过添加过滤器回调来修改默认宽度值,以适应特定主题或插件需求

📄 原文内容

Filters the allowed minimum and maximum widths for the oEmbed response.

Parameters

$min_max_widtharray
Minimum and maximum widths for the oEmbed response.

  • min int
    Minimum width. Default 200.
  • max int
    Maximum width. Default 600.

Source

$min_max_width = apply_filters(
	'oembed_min_max_width',
	array(
		'min' => 200,
		'max' => 600,
	)
);

Changelog

Version Description
4.4.0 Introduced.