From 158b76fdd854c882c7ffc06962533c42929b8377 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 17 Sep 2016 14:43:52 -0700 Subject: [PATCH] Ensure nav_menu_item setting IDs are recognized in fetch setting calls --- php/class-wp-customize-posts.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/php/class-wp-customize-posts.php b/php/class-wp-customize-posts.php index 5a2834e..a436e2d 100644 --- a/php/class-wp-customize-posts.php +++ b/php/class-wp-customize-posts.php @@ -1302,10 +1302,19 @@ public function ajax_fetch_settings() { // Return with a failure if any of the requested posts. foreach ( $post_ids as $post_id ) { $post = get_post( $post_id ); - if ( empty( $post ) || ! isset( $setting_params[ WP_Customize_Post_Setting::get_post_setting_id( $post ) ] ) ) { + if ( empty( $post ) ) { status_header( 404 ); wp_send_json_error( 'requested_post_absent' ); } + if ( 'nav_menu_item' === $post->post_type ) { + $setting_id = sprintf( 'nav_menu_item[%d]', $post->ID ); + } else { + $setting_id = WP_Customize_Post_Setting::get_post_setting_id( $post ); + } + if ( ! isset( $setting_params[ $setting_id ] ) ) { + status_header( 404 ); + wp_send_json_error( 'requested_post_setting_absent' ); + } } wp_send_json_success( $setting_params );