Disallow changing the post type in mw_editPost(). see #18429
git-svn-id: https://develop.svn.wordpress.org/trunk@19914 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
aeff5194b5
commit
362ef00fc4
|
@ -3168,6 +3168,14 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
if ( ! current_user_can( 'edit_post', $post_ID ) )
|
if ( ! current_user_can( 'edit_post', $post_ID ) )
|
||||||
return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this post.' ) );
|
return new IXR_Error( 401, __( 'Sorry, you do not have the right to edit this post.' ) );
|
||||||
|
|
||||||
|
// Use wp.editPost to edit post types other than post and page.
|
||||||
|
if ( ! in_array( $postdata[ 'post_type' ], array( 'post', 'page' ) ) )
|
||||||
|
return new IXR_Error( 401, __( 'Invalid post type.' ) );
|
||||||
|
|
||||||
|
// Thwart attempt to change the post type.
|
||||||
|
if ( ! empty( $content_struct[ 'post_type' ] ) && ( $content_struct['post_type'] != $postdata[ 'post_type' ] ) )
|
||||||
|
return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
|
||||||
|
|
||||||
// Check for a valid post format if one was given
|
// Check for a valid post format if one was given
|
||||||
if ( isset( $content_struct['wp_post_format'] ) ) {
|
if ( isset( $content_struct['wp_post_format'] ) ) {
|
||||||
$content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
|
$content_struct['wp_post_format'] = sanitize_key( $content_struct['wp_post_format'] );
|
||||||
|
@ -3197,6 +3205,9 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
if ( isset($content_struct['wp_page_order']) )
|
if ( isset($content_struct['wp_page_order']) )
|
||||||
$menu_order = $content_struct['wp_page_order'];
|
$menu_order = $content_struct['wp_page_order'];
|
||||||
|
|
||||||
|
if ( ! empty( $content_struct['wp_page_template'] ) && 'page' == $post_type )
|
||||||
|
$page_template = $content_struct['wp_page_template'];
|
||||||
|
|
||||||
$post_author = $postdata['post_author'];
|
$post_author = $postdata['post_author'];
|
||||||
|
|
||||||
// Only set the post_author if one is set.
|
// Only set the post_author if one is set.
|
||||||
|
|
Loading…
Reference in New Issue