Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#24401 closed enhancement (fixed)

Add hook for after values saved in customizer

Reported by: dovyp's profile dovyp Owned by: ryan's profile ryan
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.5
Component: Customize Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Please add the following line to the the next release of WordPress.

do_action( 'customize_save_after', $this );
to line: 514 of class-wp-customize-manager.php

The full function should look as follows:

	public function save() {
		if ( ! $this->is_preview() )
			die;

		check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce' );

		// Do we have to switch themes?
		if ( ! $this->is_theme_active() ) {
			// Temporarily stop previewing the theme to allow switch_themes()
			// to operate properly.
			$this->stop_previewing_theme();
			switch_theme( $this->get_stylesheet() );
			$this->start_previewing_theme();
		}

		do_action( 'customize_save', $this );

		foreach ( $this->settings as $setting ) {
			$setting->save();
		}
		do_action( 'customize_save_after', $this );
		die;
	}

This will allow us to use a hook for after the settings from the customizer have been saved.

Attachments (1)

24401.diff (353 bytes) - added by JustinSainton 12 years ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
12 years ago

  • Component changed from Administration to Appearance
  • Description modified (diff)
  • Severity changed from trivial to normal
  • Type changed from feature request to enhancement
  • Version changed from trunk to 3.5

#2 @markjaquith
12 years ago

  • Milestone changed from Awaiting Review to 3.6

Seems like an oversight, and I absolutely see where it would be useful. "after" hooks are a common pattern for us.

@JustinSainton
12 years ago

#3 @JustinSainton
12 years ago

  • Keywords has-patch added

#4 @ryan
12 years ago

  • Owner set to ryan
  • Resolution set to fixed
  • Status changed from new to closed

In 24344:

Introduce customize_save_after action.

Props dovyp, JustinSainton
fixes #24401

Note: See TracTickets for help on using tickets.