WP_Site_Icon::delete_attachment_data()publicWP 4.3.0

Deletes the Site Icon when the image file is deleted.

Method of the class: WP_Site_Icon{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Site_Icon = new WP_Site_Icon();
$WP_Site_Icon->delete_attachment_data( $post_id );
$post_id(int) (required)
Attachment ID.

Changelog

Since 4.3.0 Introduced.

WP_Site_Icon::delete_attachment_data() code WP 6.5.2

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' );
	}
}