钩子文档

wp_video_shortcode_class

💡 云策文档标注

概述

wp_video_shortcode_class 是一个 WordPress 过滤器,用于修改视频短码输出容器的 class 属性。它允许开发者自定义视频短码的 CSS 类,以增强样式控制。

关键要点

  • 过滤器名称:wp_video_shortcode_class
  • 参数:$class(CSS 类字符串)和 $atts(视频短码属性数组)
  • 用途:在 wp_video_shortcode() 函数中应用,用于构建视频短码输出
  • 版本历史:从 WordPress 3.6.0 引入,4.9.0 版本添加了 $atts 参数

代码示例

$atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'], $atts );

📄 原文内容

Filters the class attribute for the video shortcode output container.

Parameters

$classstring
CSS class or list of space-separated classes.
$attsarray
Array of video shortcode attributes.

Source

$atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'], $atts );

Changelog

Version Description
4.9.0 The $atts parameter was added.
3.6.0 Introduced.