Make WordPress Core

Opened 20 months ago

Last modified 7 weeks ago

#33589 new defect (bug)

Using the customizer on wp-login.php (and similar)

Reported by: daronspence Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.3
Component: Customize Keywords: needs-patch
Focuses: Cc:


See related: https://core.trac.wordpress.org/ticket/28650#comment:19

I've been attempting to write a plugin to customize the wp-login.php page using the native customizer controls. So far it seems to work fine except that postMessage settings/controls do not update. I'm not sure why it doesn't work, as it appears that all of the customizer code is loading (maybe it isn't?), but something is getting messed up at runtime. The refresh setting works fine however.

Any ideas as to what might be going on? Is this something that I can help get pushed into core? Since wp-login.php is sometimes a vital part of some sites, it makes sense that it should be available to edit in the customizer. I'm no expert but it seems that this may just be a missing hook that needs to be added to the wp-login.php file?

Change History (17)

#1 @valendesigns
20 months ago

There are plugins for this in the WP directory. Is there not one that fulfills your needs?

#2 @daronspence
20 months ago

@valendesigns I'm well aware of the various plugins and filters in core to do things with the the login page. However, there were plugins and other things in core that are now in the customizer. If the customizer can access the login page, then I think the necessary scripts should work correctly on the login page.

I'm no expert on the customizer code and debugging the complex JS needed to make it work. If someone points me in the right direction I would be happy to give it a shot though :)

#3 @celloexpressions
13 months ago

Possible duplicate, or at least related: #22139.

#4 @celloexpressions
12 months ago

#36788 was marked as a duplicate.

#5 @celloexpressions
12 months ago

  • Type changed from enhancement to defect (bug)

I think we need to investigate why postMessage and Selective Refresh don't work on the login screen, and whether we can/should make it work in core. Sounds like it may be a matter of certain scripts not being enqueued, that could be added to the new login screen hooks and are usually on wp_head.

#6 @westonruter
12 months ago

They don't work on the login page because it doesn't trigger the wp_footer action, as far as I remember, so the scripts and the data needed for the Customizer preview aren't exported.

#7 @marius2012
12 months ago


I have attached a plugin that replicate the bug: https://core.trac.wordpress.org/attachment/ticket/36788/wp-test-customizer.zip

As far i have seen in the source code, there are some scripts which enable the postMessage and selective refresh that are not loaded there:


Could be any workaround to fix this until a patch is released?

Last edited 12 months ago by marius2012 (previous) (diff)

#8 @swissspidy
12 months ago

wp_print_footer_scripts is already hooked to login_footer. Shouldn't that also handle the customizer JS files?

#9 @marius2012
12 months ago

Yes, but i think that wp_enqueue_scripts is not called and the scripts dont get loaded in wp-login because of this.

#10 @swissspidy
12 months ago

  • Keywords needs-patch added

wp_enqueue_script( 'customize-preview' ); is being called in WP_Customize_Manager::customize_preview_init() and wp_enqueue_script( 'customize-selective-refresh' ); in WP_Customize_Selective_Refresh::enqueue_preview_scripts().

Both methods also hook into wp_footer and probably should hook into login_footer as well.

Anyway, would need to look more into it to find the actual bug.

#11 @marius2012
12 months ago

yes, you are right, but i dont think they are hooking into login_footer. i've tried to debug and added some log messages in those methods and they are not fired when loading wp-login.

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.

6 months ago

#13 @lukecavanagh
6 months ago


What advantages would using the Customizer for being able to modify wp-login.php have over say?


#14 @daronspence
6 months ago

I think the biggest thing is a cohesiveness across WordPress in regards to the Customizer. Since the login page can be/is used for visitors in a large number of cases, it makes sense for that part of WordPress to be accessible via the customizer.

Currently, yes, plugins/themes can modify the login page via the hooks and filters, but things can become more user friendly and intuitive for site administrators to visually see the changes they are making live. Progressive enhancement if you will.

I imagine this could also tie into the eventual idea of launching the customizer from anywhere. I'm not sure how to tie this into that plan though. (I think that project is also pretty far away).

#15 @swissspidy
6 months ago

  • Milestone changed from Awaiting Review to Future Release

I think it would be worth exploring at least making it possible to load the customizer on the login screen without any errors.

Enabling customizing the login screen could be explored in a plugin after that.

This ticket was mentioned in Slack in #core by presskopp. View the logs.

4 months ago

#17 @westonruter
7 weeks ago

Looks like there's an additional complication for multisite. See #40069.

Note: See TracTickets for help on using tickets.