wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_ajax_get_post_thumbnail_html › WordPress Function
Since4.6.0
已弃用n/a
› wp_ajax_get_post_thumbnail_html ( 没有参数 )
定义在: |
|
文档: |
Handles retrieving HTML for the featured image via AJAX.
源码
function wp_ajax_get_post_thumbnail_html() { $post_id = (int) $_POST['post_id']; check_ajax_referer( "update-post_$post_id" ); if ( ! current_user_can( 'edit_post', $post_id ) ) { wp_die( -1 ); } $thumbnail_id = (int) $_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 ); }