Tribe__Admin__Notices::register_transient( string $slug, string $html, array $arguments = array(), int $expire = null )
Create a transient Admin Notice easily.
Contents
A transient admin notice is a "fire-and-forget" admin notice that will display once registered and until dismissed (if dismissible) without need, on the side of the source code, to register it on each request.
Parameters
- $slug
-
(string) (Required) Slug to save the notice
- $html
-
(string) (Required) The notice output HTML code
- $arguments
-
(array) (Optional) Arguments to Setup a notice
Default value: array()
- $expire
-
(int) (Optional) After how much time (in seconds) the notice will stop showing.
Default value: null
Return
(stdClass) Which notice was registered
Source
File: src/Tribe/Admin/Notices.php
public function register_transient( $slug, $html, $arguments = array(), $expire = null ) {
$notices = $this->get_transients();
$notices[ $slug ] = array( $html, $arguments, time() + $expire );
$this->set_transients( $notices );
}
Changelog
| Version | Description |
|---|---|
| 4.7.7 | Introduced. |