Make WordPress Core

Changeset 40688 for branches/3.7


Ignore:
Timestamp:
05/16/2017 08:30:47 AM (9 years ago)
Author:
swissspidy
Message:

Whitelist post arguments in XML-RPC

Merges [40677] to the 3.7 branch.

Location:
branches/3.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/src

  • branches/3.7/src/wp-includes/class-wp-xmlrpc-server.php

    r34157 r40688  
    10511051         */
    10521052        protected function _insert_post( $user, $content_struct ) {
    1053                 $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => 0,
    1054                         'post_password' => '', 'post_excerpt' => '', 'post_content' => '', 'post_title' => '' );
    1055 
    1056                 $post_data = wp_parse_args( $content_struct, $defaults );
     1053                $defaults = array(
     1054                        'post_status'    => 'draft',
     1055                        'post_type'      => 'post',
     1056                        'post_author'    => null,
     1057                        'post_password'  => null,
     1058                        'post_excerpt'   => null,
     1059                        'post_content'   => null,
     1060                        'post_title'     => null,
     1061                        'post_date'      => null,
     1062                        'post_date_gmt'  => null,
     1063                        'post_format'    => null,
     1064                        'post_name'      => null,
     1065                        'post_thumbnail' => null,
     1066                        'post_parent'    => null,
     1067                        'ping_status'    => null,
     1068                        'comment_status' => null,
     1069                        'custom_fields'  => null,
     1070                        'terms_names'    => null,
     1071                        'terms'          => null,
     1072                        'sticky'         => null,
     1073                        'enclosure'      => null,
     1074                        'ID'             => null,
     1075                );
     1076
     1077                $post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults );
    10571078
    10581079                $post_type = get_post_type_object( $post_data['post_type'] );
     
    12341255                        $post_data['tax_input'] = $terms;
    12351256                        unset( $post_data['terms'], $post_data['terms_names'] );
    1236                 } else {
    1237                         // do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'
    1238                         unset( $post_data['tax_input'], $post_data['post_category'], $post_data['tags_input'] );
    12391257                }
    12401258
Note: See TracChangeset for help on using the changeset viewer.