钩子文档

media_view_strings

💡 云策文档标注

概述

media_view_strings 过滤器用于修改媒体视图中的字符串数组,这些字符串在 JavaScript 中被引用。它接受一个字符串数组和一个 WP_Post 对象作为参数。

关键要点

  • 过滤器名称:media_view_strings
  • 参数:$strings(字符串数组,键为 JavaScript 引用名),$post(WP_Post 对象)
  • 用法:apply_filters('media_view_strings', $strings, $post)
  • 相关函数:wp_enqueue_media() 用于加载媒体相关资源
  • 引入版本:WordPress 3.5.0

📄 原文内容

Filters the media view strings.

Parameters

$stringsstring[]
Array of media view strings keyed by the name they’ll be referenced by in JavaScript.
$postWP_Post
Post object.

Source

$strings = apply_filters( 'media_view_strings', $strings, $post );

Changelog

Version Description
3.5.0 Introduced.