Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #274 from xwp/bugfix/recognize-nav-menu-item-setti…
Browse files Browse the repository at this point in the history
…ng-ids

Ensure nav_menu_item setting IDs are recognized in requests to fetch settings
  • Loading branch information
westonruter authored Sep 17, 2016
2 parents ef2476b + 158b76f commit 307ad03
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion php/class-wp-customize-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 307ad03

Please sign in to comment.