Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Adding Notices in the Block Editor Wordpress

( function ( wp ) {
    wp.data.dispatch( 'core/notices' ).createNotice(
        'success', // Can be one of: success, info, warning, error.
        'Post published.', // Text string to display.
        {
            isDismissible: true, // Whether the user can dismiss the notice.
            // Any actions the user can perform.
            actions: [
                {
                    url: '#',
                    label: 'View post',
                },
            ],
        }
    );
} )( window.wp );
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Adding #Notices #Block #Editor #Wordpress
ADD COMMENT
Topic
Name
8+7 =