Notices Data Edit

Namespace: core/notices.

Selectors 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

  • Array<WPNotice>: Array of notices.

Top ↑

Actions 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

Yields action objects used in signalling that a notice is to be created.

Parameters

  • status ?string: Notice status. Defaults to info.
  • 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. Defaults to true.
  • options.speak ?boolean: Whether the notice content should be announced to screen readers. Defaults to true.
  • options.actions ?Array<WPNoticeAction>: User actions to be presented with notice.

# 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.