Your Site Doesn’t Include Support for the Block in WordPress

WordPress shows “Your site doesn’t include support for the block” when a post contains a block type that is no longer registered. It usually happens after you deactivate a block plugin, switch away from a theme that registered its own blocks, or rename a custom block’s namespace. The editor only tells you about it when you open the affected post. With hundreds of posts, template parts and synced patterns, you have no idea how many are broken until a client finds one.

This snippet adds Tools → Unsupported Blocks. Click Scan content and it lists every unregistered block name and each post, page, template, template part or pattern that uses it, with an edit link to each. From there you can decide whether to reactivate the plugin or replace the blocks. It goes in a small plugin, an mu-plugin or your theme’s functions.php, and works pasted into a Scripts Organizer PHP block.

The snippet

<?php
/**
 * Plugin Name: DPC Unsupported Block Finder
 * Description: Tools > Unsupported Blocks lists content that uses block types WordPress no longer has registered.
 */

defined( 'ABSPATH' ) || exit;

/**
 * Return the names of unregistered block types in a parsed block tree (inner blocks included).
 */
function dpc_unsupported_block_names( array $blocks ): array {
	$registry = WP_Block_Type_Registry::get_instance();
	$ignore   = (array) apply_filters( 'dpc_unsupported_blocks_ignore', [] );
	$found    = [];

	foreach ( $blocks as $block ) {
		$name = $block['blockName'] ?? null;

		if ( is_string( $name ) && '' !== $name && ! in_array( $name, $ignore, true ) && ! $registry->is_registered( $name ) ) {
			$found[ $name ] = true;
		}

		if ( ! empty( $block['innerBlocks'] ) ) {
			foreach ( dpc_unsupported_block_names( $block['innerBlocks'] ) as $inner ) {
				$found[ $inner ] = true;
			}
		}
	}

	return array_keys( $found );
}

/**
 * Scan all block content in batches. Returns [ 'block/name' => [ post IDs ] ].
 */
function dpc_scan_unsupported_blocks( int $batch = 200 ): array {
	global $wpdb;

	$report  = [];
	$last_id = 0;
	$like    = '%' . $wpdb->esc_like( '<!-- wp:' ) . '%';

	do {
		$rows = $wpdb->get_results(
			$wpdb->prepare(
				"SELECT ID, post_content FROM {$wpdb->posts}
				WHERE ID > %d
				AND post_type <> 'revision'
				AND post_status NOT IN ( 'auto-draft', 'trash' )
				AND post_content LIKE %s
				ORDER BY ID ASC
				LIMIT %d",
				$last_id,
				$like,
				$batch
			)
		);

		foreach ( $rows as $row ) {
			$last_id = (int) $row->ID;
			foreach ( dpc_unsupported_block_names( parse_blocks( $row->post_content ) ) as $name ) {
				$report[ $name ][] = $last_id;
			}
		}
	} while ( count( $rows ) === $batch );

	ksort( $report );
	return $report;
}

add_action( 'admin_menu', 'dpc_unsupported_blocks_menu' );
function dpc_unsupported_blocks_menu(): void {
	add_management_page(
		'Unsupported Blocks',
		'Unsupported Blocks',
		'manage_options',
		'dpc-unsupported-blocks',
		'dpc_unsupported_blocks_page'
	);
}

function dpc_unsupported_blocks_page(): void {
	if ( ! current_user_can( 'manage_options' ) ) {
		wp_die( esc_html__( 'Sorry, you are not allowed to access this page.' ) );
	}

	$nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';
	$scan  = isset( $_GET['dpc_scan'] ) && wp_verify_nonce( $nonce, 'dpc_unsupported_blocks_scan' );

	echo '<div class="wrap"><h1>Unsupported Blocks</h1>';
	echo '<p>Finds content with blocks the editor reports as &#8220;Your site doesn&#8217;t include support for this block&#8221;.</p>';
	echo '<form method="get">';
	echo '<input type="hidden" name="page" value="dpc-unsupported-blocks">';
	wp_nonce_field( 'dpc_unsupported_blocks_scan', '_wpnonce', false );
	echo '<button type="submit" name="dpc_scan" value="1" class="button button-primary">Scan content</button>';
	echo '</form>';

	if ( ! $scan ) {
		echo '</div>';
		return;
	}

	$report = dpc_scan_unsupported_blocks();

	if ( ! $report ) {
		echo '<p><strong>No unsupported blocks found.</strong></p></div>';
		return;
	}

	echo '<table class="widefat striped" style="margin-top:1em"><thead><tr><th>Block</th><th>Used in</th></tr></thead><tbody>';

	foreach ( $report as $name => $ids ) {
		$links = [];
		foreach ( $ids as $id ) {
			$title   = get_the_title( $id );
			$label   = sprintf( '%s (%s #%d)', '' !== $title ? $title : '(no title)', (string) get_post_type( $id ), $id );
			$url     = get_edit_post_link( $id, 'raw' );
			$links[] = $url
				? sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html( $label ) )
				: esc_html( $label );
		}

		printf(
			'<tr><td><code>%s</code></td><td>%s</td></tr>',
			esc_html( $name ),
			implode( '<br>', $links )
		);
	}

	echo '</tbody></table></div>';
}

How it works

  • dpc_scan_unsupported_blocks() reads only rows whose post_content contains <!-- wp:, 200 at a time and keyed on the post ID. Large sites never load everything into memory at once. Revisions, auto-drafts and trashed items are skipped.
  • Each row goes through parse_blocks(), the parser core uses itself. dpc_unsupported_block_names() walks the tree recursively, so a missing block inside a Group, Columns or Cover block is found too.
  • A block counts as unsupported when WP_Block_Type_Registry::get_instance()->is_registered() returns false. Classic content (blocks with a null name) is ignored.
  • Because the query isn’t limited by post type, templates, template parts, synced patterns (wp_block) and navigation menus are scanned as well. These are the places that are hardest to find by hand.
  • The page needs manage_options. The scan only runs when the request carries a valid nonce, so a crafted link can’t make an admin’s browser start the heavy query. All output is escaped.

If you want to process blocks in a different way, the recursive walk follows the same pattern as looping over all blocks.

Customise it

  • Ignore known false positives. Some plugins still register blocks only in JavaScript, so PHP never sees them, and the scan reports them even though the editor handles them fine. Exclude them: add_filter( 'dpc_unsupported_blocks_ignore', fn( $names ) => [ ...$names, 'acme/js-only-block' ] );
  • Change the batch size by calling dpc_scan_unsupported_blocks( 500 ) if your database handles bigger reads comfortably.
  • Run it from code. The scanner is a plain function, so you can call it from a WP-CLI eval (wp eval 'print_r( dpc_scan_unsupported_blocks() );') when the snippet is loaded as a plugin or mu-plugin.

Gotchas

  • The fastest fix is nearly always to reactivate the plugin that owned the block. Its content comes back unchanged. Only replace blocks once you are sure the plugin is gone for good.
  • If you renamed your own block (old/cta to new/cta), saved posts still say old/cta. Add a block transform or run a search-replace on the comment delimiters. Back up before you replace anything.
  • Plugins that register blocks late, after init or only on certain screens, may show up as unsupported here. Add those to the ignore filter.
  • The scan reads the database directly. It doesn’t see block markup that a theme generates at runtime, such as file-based templates in /templates that were never customised in the Site Editor.

Snippet poll. Should this snippet be in the Scripts Organizer library for one-click import? 10 votes put it there.

0 of 10 votes

// newsletter

Three tested WordPress snippets a week

Blocks, security, performance, Tailwind, PHP and React. Copy, paste, ship. You’ll also get DPlugins product updates. No spam, and you can unsubscribe anytime.

// newsletter

Three tested WordPress snippets a week

Blocks, security, performance, Tailwind, PHP and React. Copy, paste, ship. You'll also get DPlugins product updates. No spam, and you can unsubscribe anytime.