WP_Site_Icon::delete_attachment_data() WordPress Method

The WP_Site_Icon::delete_attachment_data() method is used to delete the attachment data for a site icon. This is useful when you want to change the icon for a site, or when you want to remove the icon altogether.

WP_Site_Icon::delete_attachment_data( int $post_id ) #

Deletes the Site Icon when the image file is deleted.


Parameters

$post_id

(int)(Required)Attachment ID.


Top ↑

Source

File: wp-admin/includes/class-wp-site-icon.php

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

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


Top ↑

Changelog

Changelog
VersionDescription
4.3.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.