Notices Data
Edit
Namespace: core/notices.
Selectors
getNotices
Returns all notices as an array, optionally for a given context. Defaults to
the global context.
Parameters
- state
Object: Notices state. - context
?string: Optional grouping context.
Returns
WPNotice[]: Array of notices.
Actions
createErrorNotice
Returns an action object used in signalling that an error notice is to be
created. Refer to createNotice for options documentation.
Related
- createNotice
Parameters
- content
string: Notice message. - options
[Object]: Optional notice options.
Returns
Object: Action object.
createInfoNotice
Returns an action object used in signalling that an info notice is to be
created. Refer to createNotice for options documentation.
Related
- createNotice
Parameters
- content
string: Notice message. - options
[Object]: Optional notice options.
Returns
Object: Action object.
createNotice
Returns an action object used in signalling that a notice is to be created.
Parameters
- status
[string]: Notice status. - content
string: Notice message. - options
[Object]: Notice options. - options.context
[string]: Context under which to group notice. - options.id
[string]: Identifier for notice. Automatically assigned if not specified. - options.isDismissible
[boolean]: Whether the notice can be dismissed by user. - options.type
[string]: Type of notice, one ofdefault, orsnackbar. - options.speak
[boolean]: Whether the notice content should be announced to screen readers. - options.actions
[Array<WPNoticeAction>]: User actions to be presented with notice. - options.icon
[Object]: An icon displayed with the notice. - options.explicitDismiss
[boolean]: Whether the notice includes an explict dismiss button and can’t be dismissed by clicking the body of the notice. - options.onDismiss
[Function]: Called when the notice is dismissed.
Returns
Object: Action object.
createSuccessNotice
Returns an action object used in signalling that a success notice is to be
created. Refer to createNotice for options documentation.
Related
- createNotice
Parameters
- content
string: Notice message. - options
[Object]: Optional notice options.
Returns
Object: Action object.
createWarningNotice
Returns an action object used in signalling that a warning notice is to be
created. Refer to createNotice for options documentation.
Related
- createNotice
Parameters
- content
string: Notice message. - options
[Object]: Optional notice options.
Returns
Object: Action object.
removeNotice
Returns an action object used in signalling that a notice is to be removed.
Parameters
- id
string: Notice unique identifier. - context
[string]: Optional context (grouping) in which the notice is intended to appear. Defaults to default context.
Returns
Object: Action object.