Dismiss

The Dismiss class, responsible for dismissing and checking the status of admin notices.

Tags
since
1.0.0

Table of Contents

$id  : string
The notice-ID.
$prefix  : string
The prefix we'll be using for the option/user-meta.
$scope  : string
The notice's scope. Can be "user" or "global".
__construct()  : mixed
Constructor.
ajax_maybe_dismiss_notice()  : void
Run check to see if we need to dismiss the notice.
is_dismissed()  : bool
Check if the notice has been dismissed or not.
print_script()  : void
Print the script for dismissing the notice.
dismiss_notice()  : void
Actually dismisses the notice.

Properties

$id

The notice-ID.

private string $id
Tags
access

private

since
1.0

$prefix

The prefix we'll be using for the option/user-meta.

private string $prefix
Tags
access

private

since
1.0

$scope

The notice's scope. Can be "user" or "global".

private string $scope
Tags
access

private

since
1.0

Methods

__construct()

Constructor.

public __construct(string $id, string $prefix[, mixed $scope = 'global' ]) : mixed
Parameters
$id : string

A unique ID for this notice. Can contain lowercase characters and underscores.

$prefix : string

The prefix that will be used for the option/user-meta.

$scope : mixed = 'global'
Tags
access

public

since
1.0
Return values
mixed

ajax_maybe_dismiss_notice()

Run check to see if we need to dismiss the notice.

public ajax_maybe_dismiss_notice() : void

If all tests are successful then call the dismiss_notice() method.

Tags
access

public

since
1.0
Return values
void

is_dismissed()

Check if the notice has been dismissed or not.

public is_dismissed() : bool
Tags
access

public

since
1.0
Return values
bool

print_script()

Print the script for dismissing the notice.

public print_script() : void
Tags
access

private

since
1.0
Return values
void

dismiss_notice()

Actually dismisses the notice.

private dismiss_notice() : void
Tags
access

private

since
1.0
Return values
void

Search results