Tribe__Admin__Notices::showing_notice( string|array $slug )
Checks whether a notice is being shown or not; the result takes the notice callback and dismissible status into account.
Contents
Parameters
- $slug
-
(string|array) (Required) The slug, or slugs, of the transient notices to check. This is the same slug used to register the transient notice in the
tribe_transient_noticefunction or theTribe__Admin__Notices::register_transient()method.
Return
(bool) Whether the notice is showing or not.
Source
File: src/Tribe/Admin/Notices.php
public function showing_notice( $slug ) {
if ( ! isset( $this->notices[ $slug ] ) ) {
return false;
}
$notice = $this->notices[ $slug ];
if ( $notice->dismiss && $this->has_user_dimissed( $notice->slug ) ) {
return false;
}
if (
! empty( $notice->active_callback )
&& is_callable( $notice->active_callback )
&& false == call_user_func( $notice->active_callback )
) {
return false;
}
return true;
}
Changelog
| Version | Description |
|---|---|
| 4.11.1 | Introduced. |