Uses
Uses | Description |
---|---|
wp-includes/theme.php: get_stylesheet() | Retrieves name of the current stylesheet. |
wp-includes/post.php: update_post_meta() | Updates a post meta field based on the given post ID. |
Updates the last-used postmeta on a header image attachment after saving a new header image via the Customizer.
(WP_Customize_Manager) (Required) Customize manager.
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() ); }
Version | Description |
---|---|
3.9.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/custom_image_header/customize_set_last_used