钩子文档

wp_audio_shortcode_override

💡 云策文档标注

概述

wp_audio_shortcode_override 是一个 WordPress 过滤器,用于覆盖默认的音频短码输出。如果过滤后的输出非空,将替代默认音频模板的生成。

关键要点

  • 这是一个过滤器,允许开发者自定义音频短码的 HTML 输出。
  • 过滤器参数包括 $html(空字符串)、$attr(短码属性数组)、$content(短码内容)和 $instance(音频短码实例的唯一数字 ID)。
  • 在 wp_audio_shortcode() 函数中调用,用于构建音频短码输出。
  • 从 WordPress 3.6.0 版本开始引入。

📄 原文内容

Filters the default audio shortcode output.

Description

If the filtered output isn’t empty, it will be used instead of generating the default audio template.

Parameters

$htmlstring
Empty variable to be replaced with shortcode markup.
$attrarray
Attributes of the shortcode. See wp_audio_shortcode().
$contentstring
Shortcode content.
$instanceint
Unique numeric ID of this audio shortcode instance.

Source

$override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instance );

Changelog

Version Description
3.6.0 Introduced.