Skip to content

Instantly share code, notes, and snippets.

@httpstersk
Created January 26, 2019 16:44
Show Gist options
  • Save httpstersk/f62315afd07074b56bf3bafeccdddfda to your computer and use it in GitHub Desktop.
Save httpstersk/f62315afd07074b56bf3bafeccdddfda to your computer and use it in GitHub Desktop.
➊➏ Create an admin notice with custom styled HTML element
const NOTICE_STATUS = 'success'; // Available: info, success, warning, error
const HTML_ELEMENT = '<h1 style="text-align: center">Gutenberg ist gut! 🙌</h1>';
const { dispatch } = wp.data;
const { createNotice } = dispatch( 'core/notices' );
createNotice( NOTICE_STATUS, HTML_ELEMENT, { __unstableHTML: true } );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment