W3cubDocs

/WordPress

WP_Site_Icon::delete_attachment_data( int $post_id )

Deletes the Site Icon when the image file is deleted.

Parameters

$post_idintrequired
Attachment ID.

Source

public function delete_attachment_data( $post_id ) {
	$site_icon_id = (int) get_option( 'site_icon' );

	if ( $site_icon_id && $post_id === $site_icon_id ) {
		delete_option( 'site_icon' );
	}
}

Changelog

Version Description
4.3.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_site_icon/delete_attachment_data