wp_increase_content_media_count

函式
wp_increase_content_media_count ( $amount = 1 )
Access
Private
引數
  • (int) $amount Optional. Amount to increase by. Default 1.
    Required:
    Default: 1
返回值
  • (int) The latest content media count, after the increase.
定義位置
相關方法
wp_update_comment_countwp_admin_bar_new_content_menuwp_is_json_media_typewp_defer_comment_countingwp_update_comment_count_now
引入
5.9.0
棄用
-

wp_increase_content_media_count: 當一個媒體專案被新增到一個文章或頁面時,這個函式用來增加該文章或頁面的媒體計數。它接收一個文章ID作為引數,並更新該文章的媒體計數。

增加一個內部內容媒體計數變數。

function wp_increase_content_media_count( $amount = 1 ) {
	static $content_media_count = 0;

	$content_media_count += $amount;

	return $content_media_count;
}

常見問題

FAQs
檢視更多 >