get_block_editor_server_block_settings

The timeline below displays how wordpress function get_block_editor_server_block_settings has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 * @since 6.3.0 Added `selectors` field.
 * @since 6.4.0 Added `block_hooks` field.
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $fields_to_pick = array('api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'block_hooks' => 'blockHooks', 'selectors' => 'selectors', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'ancestor' => 'ancestor', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations', 'allowed_blocks' => 'allowedBlocks');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($fields_to_pick as $field => $key) {
            if (!isset($block_type->{$field})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$field};
        }
    }
    return $blocks;
}

WordPress Version: 6.4

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 * @since 6.3.0 Added `selectors` field.
 * @since 6.4.0 Added `block_hooks` field.
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $fields_to_pick = array('api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'block_hooks' => 'blockHooks', 'selectors' => 'selectors', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'ancestor' => 'ancestor', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($fields_to_pick as $field => $key) {
            if (!isset($block_type->{$field})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$field};
        }
    }
    return $blocks;
}

WordPress Version: 6.3

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 * @since 6.3.0 Added `selectors` field.
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $fields_to_pick = array('api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'selectors' => 'selectors', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'ancestor' => 'ancestor', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($fields_to_pick as $field => $key) {
            if (!isset($block_type->{$field})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$field};
        }
    }
    return $blocks;
}

WordPress Version: 6.1

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $fields_to_pick = array('api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'ancestor' => 'ancestor', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($fields_to_pick as $field => $key) {
            if (!isset($block_type->{$field})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$field};
        }
    }
    return $blocks;
}

WordPress Version: 5.8

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $fields_to_pick = array('api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'keywords' => 'keywords', 'example' => 'example', 'variations' => 'variations');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($fields_to_pick as $field => $key) {
            if (!isset($block_type->{$field})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$field};
        }
    }
    return $blocks;
}

WordPress Version: 5.7

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $fields_to_pick = array('api_version' => 'apiVersion', 'title' => 'title', 'description' => 'description', 'icon' => 'icon', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'supports' => 'supports', 'category' => 'category', 'styles' => 'styles', 'textdomain' => 'textdomain', 'parent' => 'parent', 'keywords' => 'keywords', 'example' => 'example');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($fields_to_pick as $field => $key) {
            if (!isset($block_type->{$field})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$field};
        }
    }
    return $blocks;
}

WordPress Version: 5.5

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $fields_to_pick = array('title' => 'title', 'description' => 'description', 'icon' => 'icon', 'category' => 'category', 'keywords' => 'keywords', 'parent' => 'parent', 'supports' => 'supports', 'attributes' => 'attributes', 'provides_context' => 'providesContext', 'uses_context' => 'usesContext', 'styles' => 'styles', 'textdomain' => 'textdomain', 'example' => 'example');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($fields_to_pick as $field => $key) {
            if (!isset($block_type->{$field})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$field};
        }
    }
    return $blocks;
}

WordPress Version: 5.3

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $keys_to_pick = array('title', 'description', 'icon', 'category', 'keywords', 'parent', 'supports', 'attributes', 'styles');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($keys_to_pick as $key) {
            if (!isset($block_type->{$key})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$key};
        }
    }
    return $blocks;
}

WordPress Version: 5.0

/**
 * Prepares server-registered blocks for the block editor.
 *
 * Returns an associative array of registered block data keyed by block name. Data includes properties
 * of a block relevant for client registration.
 *
 * @since 5.0.0
 *
 * @return array An associative array of registered block data.
 */
function get_block_editor_server_block_settings()
{
    $block_registry = WP_Block_Type_Registry::get_instance();
    $blocks = array();
    $keys_to_pick = array('title', 'description', 'icon', 'category', 'keywords', 'supports', 'attributes');
    foreach ($block_registry->get_all_registered() as $block_name => $block_type) {
        foreach ($keys_to_pick as $key) {
            if (!isset($block_type->{$key})) {
                continue;
            }
            if (!isset($blocks[$block_name])) {
                $blocks[$block_name] = array();
            }
            $blocks[$block_name][$key] = $block_type->{$key};
        }
    }
    return $blocks;
}