• I’d like to remove the placeholder in an empty block ‘type / to choose a block’.

    I often have empty spaces in my drafts as I’m writing and this placeholder clutters everything. I’d just like it empty. Is there a way to remove it with a filter?

    • This topic was modified 2 years, 5 months ago by t-p. Reason: Moved to Fixing WordPress from Developing with WordPress
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    Here’s the filter doc: https://developer.www.ads-software.com/reference/hooks/write_your_story/

    add_filter( 'write_your_story', function ( $string, $post ){ return ' '; }, 10,2);

    Thread Starter rcthink

    (@rcthink)

    Thanks Sébastien. This seems to only adjust the placeholder text that’s initially in the post. As soon as any paragraph blocks are added, they contain the placeholder text.

    I ended up adding a css file to load with the block editor that just hides them with css.

    functions.php
    // include style sheet for the block editor
    add_action( ‘enqueue_block_editor_assets’, function() {
    wp_enqueue_style( ‘include_block_editor_styles’, get_stylesheet_directory_uri() . “/block-editor.css”, false, ‘1.0’, ‘all’ );
    } );

    block-editor.css
    .block-editor-block-list__block[data-empty=true] [data-rich-text-placeholder] {
    visibility: hidden;
    }

    Not ideal but it does what I wanted it to do.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove ‘type / to choose a block’ block placeholder’ is closed to new replies.