WP_Paused_Extensions_Storage::delete() WordPress Method

The delete() method of the WP_Paused_Extensions_Storage class deletes an extension from the paused extension store. The paused extension store is used to keep track of which extensions have been paused by the user. This is useful in case the user wants to unpause an extension at a later time.

WP_Paused_Extensions_Storage::delete( string $extension ) #

Forgets a previously recorded extension error.


Parameters

$extension

(string)(Required)Plugin or theme directory name.


Top ↑

Return

(bool) True on success, false on failure.


Top ↑

Source

File: wp-includes/class-wp-paused-extensions-storage.php

	public function delete( $extension ) {
		if ( ! $this->is_api_loaded() ) {
			return false;
		}

		$option_name = $this->get_option_name();

		if ( ! $option_name ) {
			return false;
		}

		$paused_extensions = (array) get_option( $option_name, array() );

		// Do not delete if no error is stored.
		if ( ! isset( $paused_extensions[ $this->type ][ $extension ] ) ) {
			return true;
		}

		unset( $paused_extensions[ $this->type ][ $extension ] );

		if ( empty( $paused_extensions[ $this->type ] ) ) {
			unset( $paused_extensions[ $this->type ] );
		}

		// Clean up the entire option if we're removing the only error.
		if ( ! $paused_extensions ) {
			return delete_option( $option_name );
		}

		return update_option( $option_name, $paused_extensions );
	}


Top ↑

Changelog

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