WP_Paused_Extensions_Storage::set

Advertisement

Summery Summery

Records an extension error.

Syntax Syntax

WP_Paused_Extensions_Storage::set( string $extension, array $error )

Description Description

Only one error is stored per extension, with subsequent errors for the same extension overriding the previously stored error.

Parameters Parameters

$extension

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

$error

(array) (Required) Error that was triggered.

  • 'type'
    (string) The error type.
  • 'file'
    (string) The name of the file in which the error occurred.
  • 'line'
    (string) The line number in which the error occurred.
  • 'message'
    (string) The error message.

Return Return

(bool) True on success, false on failure.

Source Source

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

	public function set( $extension, $error ) {
		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 update if the error is already stored.
		if ( isset( $paused_extensions[ $this->type ][ $extension ] ) && $paused_extensions[ $this->type ][ $extension ] === $error ) {
			return true;
		}

		$paused_extensions[ $this->type ][ $extension ] = $error;

		return update_option( $option_name, $paused_extensions );
	}

Advertisement

Changelog Changelog

Changelog
Version Description
5.2.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.