diff --git a/wp-includes/class-wp-xmlrpc-server.php b/wp-includes/class-wp-xmlrpc-server.php
index a5273f9..0eb3944 100644
a
|
b
|
class wp_xmlrpc_server extends IXR_Server { |
75 | 75 | 'wp.getCommentStatusList' => 'this:wp_getCommentStatusList', |
76 | 76 | 'wp.getMediaItem' => 'this:wp_getMediaItem', |
77 | 77 | 'wp.getMediaLibrary' => 'this:wp_getMediaLibrary', |
| 78 | 'wp.deleteMediaItem' => 'this:wp_deleteMediaItem', |
78 | 79 | 'wp.getPostFormats' => 'this:wp_getPostFormats', |
79 | 80 | 'wp.getPostType' => 'this:wp_getPostType', |
80 | 81 | 'wp.getPostTypes' => 'this:wp_getPostTypes', |
… |
… |
class wp_xmlrpc_server extends IXR_Server { |
3023 | 3024 | } |
3024 | 3025 | |
3025 | 3026 | /** |
| 3027 | * Delete a media item by ID |
| 3028 | * |
| 3029 | * @since 3.5.0 |
| 3030 | * |
| 3031 | * @param array $args Method parameters. Contains: |
| 3032 | * - blog_id |
| 3033 | * - username |
| 3034 | * - password |
| 3035 | * - attachment_id |
| 3036 | * @return false if delete failed, attachment data on success. |
| 3037 | */ |
| 3038 | function wp_deleteMediaItem( $args ) { |
| 3039 | $this->escape( $args ); |
| 3040 | |
| 3041 | $blog_id = (int) $args[0]; |
| 3042 | $username = $args[1]; |
| 3043 | $password = $args[2]; |
| 3044 | $attachment_id = (int) $args[3]; |
| 3045 | |
| 3046 | if ( !$user = $this->login( $username, $password ) ) |
| 3047 | return $this->error; |
| 3048 | |
| 3049 | do_action( 'xmlrpc_call', 'wp.deleteMediaItem' ); |
| 3050 | |
| 3051 | if ( !current_user_can('upload_files') ) { |
| 3052 | $this->error = new IXR_Error( 401, __( 'You do not have permission to delete files.' ) ); |
| 3053 | return $this->error; |
| 3054 | } |
| 3055 | |
| 3056 | if ( ! $attachment = get_post($attachment_id) ) |
| 3057 | return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); |
| 3058 | |
| 3059 | return wp_delete_attachment( $attachment_id ); |
| 3060 | } |
| 3061 | |
| 3062 | /** |
3026 | 3063 | * Retrieves a list of post formats used by the site |
3027 | 3064 | * |
3028 | 3065 | * @since 3.1 |