wp_ajax_get_post_thumbnail_html() - WordPress 函数参考中文文档

返回介绍

wp_ajax_get_post_thumbnail_html()

发布于 2017-09-11 字数1437 浏览 881 评论 0

wp_ajax_get_post_thumbnail_html()

Ajax handler for retrieving HTML for the featured image.


描述


源代码

File: wp-admin/includes/ajax-actions.php

function wp_ajax_get_post_thumbnail_html() {
	$post_ID = intval( $_POST['post_id'] );

	check_ajax_referer( "update-post_$post_ID" );

	if ( ! current_user_can( 'edit_post', $post_ID ) ) {
		wp_die( -1 );
	}

	$thumbnail_id = intval( $_POST['thumbnail_id'] );

	// For backward compatibility, -1 refers to no featured image.
	if ( -1 === $thumbnail_id ) {
		$thumbnail_id = null;
	}

	$return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID );
	wp_send_json_success( $return );
}

更新日志

Version 描述
4.6.0 Introduced.

相关函数

Uses

  • wp-admin/includes/post.php:
    _wp_post_thumbnail_html()
  • wp-includes/capabilities.php:
    current_user_can()
  • wp-includes/pluggable.php:
    check_ajax_referer()
  • wp-includes/functions.php:
    wp_send_json_success()
  • wp-includes/functions.php:
    wp_die()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!