Custom_Image_Header::customize_set_last_used() WordPress Method

The Custom_Image_Header::customize_set_last_used() Wordpress method is used to set the last used image for the custom header. This is called when the user saves the Customizer state.

Custom_Image_Header::customize_set_last_used( WP_Customize_Manager $wp_customize ) #

Updates the last-used postmeta on a header image attachment after saving a new header image via the Customizer.


Parameters

$wp_customize

(WP_Customize_Manager)(Required)Customize manager.


Top ↑

Source

File: wp-admin/includes/class-custom-image-header.php

	public function customize_set_last_used( $wp_customize ) {

		$header_image_data_setting = $wp_customize->get_setting( 'header_image_data' );

		if ( ! $header_image_data_setting ) {
			return;
		}

		$data = $header_image_data_setting->post_value();

		if ( ! isset( $data['attachment_id'] ) ) {
			return;
		}

		$attachment_id = $data['attachment_id'];
		$key           = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
		update_post_meta( $attachment_id, $key, time() );
	}


Top ↑

Changelog

Changelog
VersionDescription
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.