Changeset 22173 for trunk/wp-admin/includes/ajax-actions.php
- Timestamp:
- 10/10/2012 11:32:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/ajax-actions.php
r22129 r22173 1821 1821 wp_send_json_success( $posts ); 1822 1822 } 1823 1824 /** 1825 * Save attachment attributes. 1826 * 1827 * @since 3.5.0 1828 */ 1829 function wp_ajax_save_attachment() { 1830 if ( ! isset( $_REQUEST['id'] ) || ! isset( $_REQUEST['changes'] ) ) 1831 wp_send_json_error(); 1832 1833 if ( ! $id = absint( $_REQUEST['id'] ) ) 1834 wp_send_json_error(); 1835 1836 if ( ! current_user_can( 'edit_post', $id ) ) 1837 wp_send_json_error(); 1838 1839 $changes = $_REQUEST['changes']; 1840 $args = array(); 1841 1842 if ( $changes['title'] ) 1843 $args['post_title'] = $changes['title']; 1844 1845 if ( $changes['caption'] ) 1846 $args['post_excerpt'] = $changes['caption']; 1847 1848 if ( $args ) 1849 wp_update_post( array_merge( $args, array( 'ID' => $id ) ) ); 1850 1851 wp_send_json_success(); 1852 }
Note: See TracChangeset
for help on using the changeset viewer.