wp_increase_content_media_count()
云策文档标注
概述
wp_increase_content_media_count() 是一个 WordPress 函数,用于增加内部内容媒体计数变量。它接受一个可选参数来指定增加量,并返回增加后的最新计数值。
关键要点
- 函数 wp_increase_content_media_count() 用于递增静态变量 $content_media_count。
- 参数 $amount 可选,默认值为 1,指定增加的数量。
- 返回值为增加后的最新内容媒体计数值。
- 该函数在 WordPress 5.9.0 版本中引入。
代码示例
function wp_increase_content_media_count( $amount = 1 ) {
static $content_media_count = 0;
$content_media_count += $amount;
return $content_media_count;
}
原文内容
Increases an internal content media count variable.
Parameters
$amountintoptional-
Amount to increase by.
Default:
1
Source
function wp_increase_content_media_count( $amount = 1 ) {
static $content_media_count = 0;
$content_media_count += $amount;
return $content_media_count;
}
Changelog
| Version | Description |
|---|---|
| 5.9.0 | Introduced. |