wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_declare_classic_block_necessary › WordPress Function

Seit7.1.0
Veraltetn/v
wp_declare_classic_block_necessary ( Keine Parameter )
Zugriff:
  • private
Definiert in:
Codex:

Declares a flag that the Classic block is necessary for the current post.



Quellcode

function wp_declare_classic_block_necessary(): void {
	/**
	 * Filters whether the Classic block should be available in the inserter.
	 *
	 * Defaults to false. Use this filter to opt in (globally or per post).
	 *
	 * @param bool         $supports_inserter Whether the Classic block is available in the inserter.
	 * @param WP_Post|null $post              The post being edited, or null if not in the post editor.
	 */
	if ( ! (bool) apply_filters( 'wp_classic_block_supports_inserter', false, get_post() ) ) {
		return;
	}

	wp_add_inline_script(
		'wp-block-library',
		'window.__needsClassicBlock = true;',
		'before'
	);
}