WordPress.org

Make WordPress Core

Ticket #22204: insert_post.patch

File insert_post.patch, 636 bytes (added by picklepete, 2 years ago)
  • .php

    old new class wp_xmlrpc_server_ext extends wp_xm 
    10261026                        // empty value deletes, non-empty value adds/updates 
    10271027                        if ( ! $post_data['post_thumbnail'] ) 
    10281028                                delete_post_thumbnail( $post_ID ); 
    1029                         elseif ( ! set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ) ) 
     1029                        elseif ( ! get_post( absint( $post_data['post_thumbnail'] ) ) ) 
    10301030                                return new IXR_Error( 404, __( 'Invalid attachment ID.' ) ); 
     1031                        set_post_thumbnail( $post_ID, $post_data['post_thumbnail'] ); 
    10311032                        unset( $content_struct['post_thumbnail'] ); 
    10321033                } 
    10331034