• Resolved brasofilo

    (@brasofilo)


    Hi! I haven’t troubleshooted to find if it’s a conflict with another plugin… When editing a page/post, the “Enjoying Otter Blocks?” notice always comes back.

    I’m using the following to remove it:

    add_action( 'enqueue_block_editor_assets', function () {
        $script = <<<HTML
    	jQuery( window ).load(function() { 
    		const getNotices = wp.data.select( 'core/notices' ).getNotices();
    		getNotices.forEach((v,i)=>{
    			if (v.content.includes('Otter')) wp.data.dispatch( 'core/notices' ).removeNotice(v.id)
    		});
    	});
    HTML;
        wp_add_inline_script( 'wp-blocks', $script );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter brasofilo

    (@brasofilo)

    Fixed code:

    add_action( 'enqueue_block_editor_assets', function () {
        $script = "jQuery( window ).load( function() { 
    		const isFullscreenMode = wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' ); 
    		if ( isFullscreenMode ) { 
    			wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' ); 
    		} 
    		const isDistractionFree = wp.data.select( 'core/edit-post' ).isFeatureActive( 'distractionFree' ); 
    		if ( isDistractionFree ) { 
    			wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'distractionFree' ); 
    		} 
    		const getNotices = wp.data.select( 'core/notices' ).getNotices();
    		getNotices.forEach( ( v, i )=>{
    			if ( v.content.includes( 'Otter' ) ) wp.data.dispatch( 'core/notices' ).removeNotice(v.id);
    		})
    	});";
        wp_add_inline_script( 'wp-blocks', $script );
    });
    Plugin Author Hardeep Asrani

    (@hardeepasrani)

    Hey @brasofilo,

    Are you using any other plugins on your WordPress so we could try to reproduce this on our end?

    Thank you!

    Plugin Support Stefan Cotitosu

    (@stefancotitosu)

    I am marking this thread as solved as I see no follow-up here. In case the issue occurs again, feel free to post an update.

    Regards,
    Stefan

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Dismissable notice always returning’ is closed to new replies.