Make WordPress Core

Ticket #20662: 20662.diff

File 20662.diff, 1.0 KB (added by wonderboymusic, 10 years ago)
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    48974897                $post_ID = $postdata['ID'] = get_default_post_to_edit( $post_type, true )->ID;
    48984898
    48994899                // Only posts can be sticky
    4900                 if ( $post_type == 'post' && isset( $content_struct['sticky'] ) ) {
    4901                         if ( $content_struct['sticky'] == true )
     4900                if ( 'post' === $post_type && isset( $content_struct['sticky'] ) ) {
     4901                        $sticky = wp_validate_boolean( $content_struct['sticky'] );
     4902                        if ( $sticky && ( 'private' === $postdata['post_status'] || ! empty( $postdata['post_password'] ) ) ) {
     4903                                return new IXR_Error( 401, __( 'Sorry, you cannot stick a private post.' ) );
     4904                        }
     4905
     4906                        if ( $sticky ) {
    49024907                                stick_post( $post_ID );
    4903                         elseif ( $content_struct['sticky'] == false )
     4908                        } else {
    49044909                                unstick_post( $post_ID );
     4910                        }
    49054911                }
    49064912
    49074913                if ( isset($content_struct['custom_fields']) )