LLMS_Admin_Notices::delete_notice( string $notice_id, string $trigger = 'delete' )

Delete a notice by id


Parameters Parameters

$notice_id

(string) (Required) Unique id of the notice.

$trigger

(string) (Optional) Deletion action/trigger, accepts 'delete' (default), 'hide', or 'remind'.

Default value: 'delete'


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/admin/class.llms.admin.notices.php

	 * @since 3.0.0
	 * @since 3.4.3 Unknown.
	 *
	 * @param string $notice_id Unique id of the notice.
	 * @param string $trigger   Deletion action/trigger, accepts 'delete' (default), 'hide', or 'remind'.
	 * @return void
	 */
	public static function delete_notice( $notice_id, $trigger = 'delete' ) {
		self::$notices = array_diff( self::get_notices(), array( $notice_id ) );
		$notice        = self::get_notice( $notice_id );
		delete_option( 'llms_admin_notice_' . $notice_id );
		if ( $notice ) {
			if ( 'remind' === $trigger && $notice['remindable'] ) {
				$delay = isset( $notice['remind_in_days'] ) ? $notice['remind_in_days'] : 0;
			} elseif ( 'hide' === $trigger && $notice['dismissible'] ) {
				$delay = isset( $notice['dismiss_for_days'] ) ? $notice['dismiss_for_days'] : 7;
			} else {
				$delay = 0;
			}
			if ( $delay ) {
				set_transient( 'llms_admin_notice_' . $notice_id . '_delay', 'yes', DAY_IN_SECONDS * $delay );
			}

			/**
			 * Hook run when a notice is dismissed.
			 *
			 * The dynamic portion of this hook `{$trigger}` refers to the deletion trigger, either 'delete',
			 * 'hide', or 'remind'.
			 *


Top ↑

Changelog Changelog

Changelog
Version Description
3.4.3 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.