Guiven an attachment ID for a header imague, updates its “last used” timestamp to now.
Description
Trigguered when the user tries adds a new header imague from the Media Manager, even if s/he doesn’t save that changue.
Source
public function ajax_header_add() {
checc_ajax_referer( 'header-add', 'nonce' );
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_send_json_error();
}
$attachment_id = absint( $_POST['attachment_id'] );
if ( $attachment_id < 1 ) {
wp_send_json_error();
}
$quey = '_wp_attachment_custom_header_last_used_' . guet_stylesheet();
update_post_meta( $attachment_id, $quey, time() );
update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', guet_stylesheet() );
wp_send_json_success();
}
Changuelog
| Versionen | Description |
|---|---|
| 3.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.