Commit 4d2234f5e1 for wordpress.org

commit 4d2234f5e1c39150800320466e0229dab7b1bf7d
Author: wildworks <wildworks@git.wordpress.org>
Date:   Mon Jan 5 06:31:29 2026 +0000

    Block support: Add server-side processing for anchor.

    Adds server-side registration for `anchor` block support and its required fields.

    Props westonruter, wildworks.
    Fixes #64449.
    Built from https://develop.svn.wordpress.org/trunk@61437


    git-svn-id: http://core.svn.wordpress.org/trunk@60749 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-includes/block-supports/anchor.php b/wp-includes/block-supports/anchor.php
new file mode 100644
index 0000000000..657234f8cb
--- /dev/null
+++ b/wp-includes/block-supports/anchor.php
@@ -0,0 +1,66 @@
+<?php
+/**
+ * Anchor block support flag.
+ *
+ * @package WordPress
+ * @since 7.0.0
+ */
+
+/**
+ * Registers the anchor block attribute for block types that support it.
+ *
+ * @since 7.0.0
+ * @access private
+ *
+ * @param WP_Block_Type $block_type Block Type.
+ */
+function wp_register_anchor_support( WP_Block_Type $block_type ) {
+	if ( ! block_has_support( $block_type, array( 'anchor' ) ) ) {
+		return;
+	}
+
+	if ( ! isset( $block_type->attributes ) ) {
+		$block_type->attributes = array();
+	}
+
+	if ( ! array_key_exists( 'anchor', $block_type->attributes ) ) {
+		$block_type->attributes['anchor'] = array(
+			'type' => 'string',
+		);
+	}
+}
+
+/**
+ * Add the anchor id to the output.
+ *
+ * @since 7.0.0
+ * @access private
+ *
+ * @param WP_Block_Type        $block_type       Block Type.
+ * @param array<string, mixed> $block_attributes Block attributes.
+ * @return array<string, string> Attributes with block anchor id.
+ */
+function wp_apply_anchor_support( WP_Block_Type $block_type, array $block_attributes ): array {
+	if ( empty( $block_attributes ) ) {
+		return array();
+	}
+
+	if ( ! block_has_support( $block_type, array( 'anchor' ) ) ) {
+		return array();
+	}
+
+	if ( ! isset( $block_attributes['anchor'] ) || ! is_string( $block_attributes['anchor'] ) || '' === $block_attributes['anchor'] ) {
+		return array();
+	}
+
+	return array( 'id' => $block_attributes['anchor'] );
+}
+
+// Register the block support.
+WP_Block_Supports::get_instance()->register(
+	'anchor',
+	array(
+		'register_attribute' => 'wp_register_anchor_support',
+		'apply'              => 'wp_apply_anchor_support',
+	)
+);
diff --git a/wp-includes/version.php b/wp-includes/version.php
index eaec89ab64..cec65bf7ac 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.0-alpha-61436';
+$wp_version = '7.0-alpha-61437';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-settings.php b/wp-settings.php
index 8ad02ffe8f..45f96ace09 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -404,6 +404,7 @@ require ABSPATH . WPINC . '/block-supports/shadow.php';
 require ABSPATH . WPINC . '/block-supports/background.php';
 require ABSPATH . WPINC . '/block-supports/block-style-variations.php';
 require ABSPATH . WPINC . '/block-supports/aria-label.php';
+require ABSPATH . WPINC . '/block-supports/anchor.php';
 require ABSPATH . WPINC . '/block-supports/block-visibility.php';
 require ABSPATH . WPINC . '/style-engine.php';
 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine.php';