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

Commit 4210844

Browse files
authored
Merge pull request #268 from xwp/bugfix/ensured-posts
Improve fetching settings for posts, including nav menu items
2 parents a75740d + 580fec2 commit 4210844

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

js/customize-posts.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,18 @@
218218
component.gatherFetchedPostsData = function gatherFetchedPostsData( postIds ) {
219219
var postsData = {};
220220
_.each( postIds, function( postId ) {
221-
var postType, postData, id;
221+
var postType, postData, id, setting;
222222
postType = component.fetchedPosts[ postId ];
223-
if ( postType && 'nav_menu_item' !== postType ) {
223+
if ( 'nav_menu_item' === postType ) {
224+
id = 'nav_menu_item[' + String( postId ) + ']';
225+
setting = api( id );
226+
postData = {
227+
postType: postType,
228+
customizeId: id,
229+
section: setting ? api.section( 'nav_menu[' + String( setting.get().nav_menu_term_id ) + ']' ) : null,
230+
setting: setting
231+
};
232+
} else if ( postType ) {
224233
id = 'post[' + postType + '][' + String( postId ) + ']';
225234
postData = {
226235
postType: postType,

php/class-wp-customize-posts.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ public function get_settings( array $post_ids ) {
11071107
'ignore_sticky_posts' => true,
11081108
'post_type' => get_post_types( array(), 'names' ),
11091109
'post_status' => get_post_stati( array(), 'names' ),
1110+
'posts_per_page' => count( $post_ids ),
11101111
) );
11111112
$post_setting_ids = array();
11121113
foreach ( $query->posts as $post ) {

0 commit comments

Comments
 (0)