Changeset 22979 for trunk/wp-admin/includes/ajax-actions.php
- Timestamp:
- 12/03/2012 02:38:10 AM (13 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/ajax-actions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r22967 r22979 1675 1675 1676 1676 function wp_ajax_set_post_thumbnail() { 1677 $json = ! empty( $_REQUEST['json'] ); 1678 1677 1679 $post_ID = intval( $_POST['post_id'] ); 1678 if ( !current_user_can( 'edit_post', $post_ID ) ) 1679 wp_die( -1 ); 1680 if ( !current_user_can( 'edit_post', $post_ID ) ) { 1681 $json ? wp_send_json_error() : wp_die( -1 ); 1682 } 1680 1683 $thumbnail_id = intval( $_POST['thumbnail_id'] ); 1681 1684 … … 1683 1686 1684 1687 if ( $thumbnail_id == '-1' ) { 1685 if ( delete_post_thumbnail( $post_ID ) ) 1686 wp_die( _wp_post_thumbnail_html( null, $post_ID ) ); 1687 else 1688 wp_die( 0 ); 1689 } 1690 1691 if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) 1692 wp_die( _wp_post_thumbnail_html( $thumbnail_id, $post_ID ) ); 1693 wp_die( 0 ); 1688 if ( delete_post_thumbnail( $post_ID ) ) { 1689 $return = _wp_post_thumbnail_html( null, $post_ID ); 1690 $json ? wp_send_json_success( $return ) : wp_die( $return ); 1691 } else { 1692 $json ? wp_send_json_error() : wp_die( 0 ); 1693 } 1694 } 1695 1696 if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) { 1697 $return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID ); 1698 $json ? wp_send_json_success( $return ) : wp_die( $return ); 1699 } 1700 1701 $json ? wp_send_json_error() : wp_die( 0 ); 1694 1702 } 1695 1703
Note: See TracChangeset
for help on using the changeset viewer.