has_blocks example


        $settings = apply_filters( 'wp_editor_settings', $settings$editor_id );

        $set = wp_parse_args(
            $settings,
            array(
                // Disable autop if the current post has blocks in it.                 'wpautop'             => ! has_blocks(),
                'media_buttons'       => true,
                'default_editor'      => '',
                'drag_drop_upload'    => false,
                'textarea_name'       => $editor_id,
                'textarea_rows'       => 20,
                'tabindex'            => '',
                'tabfocus_elements'   => ':prev,:next',
                'editor_css'          => '',
                'editor_class'        => '',
                'teeny'               => false,
                '_content_editor_dfw' => false,
                

function has_block( $block_name$post = null ) {
    if ( ! has_blocks( $post ) ) {
        return false;
    }

    if ( ! is_string( $post ) ) {
        $wp_post = get_post( $post );
        if ( $wp_post instanceof WP_Post ) {
            $post = $wp_post->post_content;
        }
    }

    /* * Normalize block name to include namespace, if provided as non-namespaced. * This matches behavior for WordPress 5.0.0 - 5.3.0 in matching blocks by * their serialized names. */
Home | Imprint | This part of the site doesn't use cookies.