WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

#39950 closed defect (bug) (wontfix)

window is reloaded after changing page_for_posts in Customizer even with transport->postMessage

Reported by: martinmalinda Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.2
Component: Customize Keywords: close
Focuses: ui, javascript Cc:

Description

I am setting up postMessage transport like this:

$wp_customize->get_setting( 'page_for_posts' )->transport = 'postMessage';

My hook function ins theme-customize.js is invoked, but the window gets refreshed immediately afterward which prevents doing anything meaningful.

It's also happening for page_on_front and probably show_on_front settings.

postMessage works correctly for other components for me.

Change History (2)

#1 @westonruter
4 years ago

  • Keywords close added

Actually, the preview isn't refreshing, but rather it is changing the URL to the page you just switched to. This is intentional. See this snippet in customize-controls.js:

// Change the previewed URL to the selected page when changing the page_for_posts.
api( 'page_for_posts', function( setting ) {
        setting.bind(function( pageId ) {
                pageId = parseInt( pageId, 10 );
                if ( pageId > 0 ) {
                        api.previewer.previewUrl.set( api.settings.url.home + '?page_id=' + pageId );
                }
        });
});

This behavior was introduced in #30677.

#2 @westonruter
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.