Make WordPress Core

Opened 8 years ago

Last modified 8 years ago

#40863 reopened defect (bug)

WP 4.7.5 XMLRPC new method for parsing arguments omits menu_order

Reported by: bjminihan's profile bjminihan Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.5
Component: XML-RPC Keywords:
Focuses: Cc:

Description

In WP 4.7.5, in wp-includes/class-wp-xmlrpc-server.php, on line 1327, this line:

$post_data = wp_parse_args( $content_struct, $defaults );

was changed to:

$post_data = wp_parse_args( array_intersect_key( $content_struct, $defaults ), $defaults );

Unfortunately, the new intersection strips out any arguments from $content_struct that don't exist in $defaults.

So you can no longer edit a post and change the "menu_order" field, because it doesn't exist in the $defaults declared just before this line.

Please provide either an updated list of acceptable defaults (e.g. including menu fields), or allow for additional fields to pass through to wp_parse_args.

Tested with latest version of WP, and confirmed that swapping the changed line above enables/disables the ability to change menu_order in posts.

Attachments (1)

40863.diff (507 bytes) - added by iworks 8 years ago.

Download all attachments as: .zip

Change History (7)

@iworks
8 years ago

#1 follow-up: @iworks
8 years ago

Added two params:

  • menu_order
  • to_ping

We still have to miss (based on wp_insert_post()) those fields:

  • pinged
  • import_id
  • context
  • post_content_filtered

But I'm not sure we should add it.

#WCPL2017

#2 in reply to: ↑ 1 @bjminihan
8 years ago

Adding menu_order would solve our problem nicely. Not sure my opinion matters, but I agree the other fields aren't necessary. Thanks

Replying to iworks:

Added two params:

  • menu_order
  • to_ping

We still have to miss (based on wp_insert_post()) those fields:

  • pinged
  • import_id
  • context
  • post_content_filtered

But I'm not sure we should add it.

#WCPL2017

#3 @bjminihan
8 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

#4 follow-up: @markoheijnen
8 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

I assume closing this ticket wasn't intended. Let's also at least add a basic test for this so this wouldn't happen in the future.

#5 @bjminihan
8 years ago

My apologies, but I'm not aware of the specific process I need to follow. I conducted a test on a site with the above change, and found that it worked perfectly

#6 in reply to: ↑ 4 @bjminihan
8 years ago

Replying to markoheijnen:

I assume closing this ticket wasn't intended. Let's also at least add a basic test for this so this wouldn't happen in the future.

I'm sorry, but I'm not clear on the process for implementing this change (re-inserting menu_order back into the class-wp-xmlrpc-server.file). Do you know how I would initiate that process?

Note: See TracTickets for help on using tickets.