diff --git a/packages/block-library/src/home-link/block.json b/packages/block-library/src/home-link/block.json
index 42cea69c7aaf7f..94004d2cff5474 100644
--- a/packages/block-library/src/home-link/block.json
+++ b/packages/block-library/src/home-link/block.json
@@ -6,11 +6,7 @@
"title": "Home Link",
"description": "Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header.",
"textdomain": "default",
- "attributes": {
- "label": {
- "type": "string"
- }
- },
+ "attributes": {},
"usesContext": [
"textColor",
"customTextColor",
diff --git a/packages/block-library/src/home-link/edit.js b/packages/block-library/src/home-link/edit.js
index 85571c518c8621..b64a482565a0e6 100644
--- a/packages/block-library/src/home-link/edit.js
+++ b/packages/block-library/src/home-link/edit.js
@@ -6,20 +6,14 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
-import { RichText, useBlockProps } from '@wordpress/block-editor';
-import { __ } from '@wordpress/i18n';
+import { useBlockProps } from '@wordpress/block-editor';
+import { _x } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
-import { useEffect } from '@wordpress/element';
const preventDefault = ( event ) => event.preventDefault();
-export default function HomeEdit( {
- attributes,
- setAttributes,
- context,
- clientId,
-} ) {
+export default function HomeEdit( { context, clientId } ) {
const { homeUrl } = useSelect(
( select ) => {
const {
@@ -46,14 +40,6 @@ export default function HomeEdit( {
},
} );
- const { label } = attributes;
-
- useEffect( () => {
- if ( label === undefined ) {
- setAttributes( { label: __( 'Home' ) } );
- }
- }, [ clientId, label ] );
-
return (
<>
@@ -62,23 +48,10 @@ export default function HomeEdit( {
href={ homeUrl }
onClick={ preventDefault }
>
- {
- setAttributes( { label: labelValue } );
- } }
- aria-label={ __( 'Home link text' ) }
- placeholder={ __( 'Add home link' ) }
- withoutInteractiveFormatting
- allowedFormats={ [
- 'core/bold',
- 'core/italic',
- 'core/image',
- 'core/strikethrough',
- ] }
- />
+ { _x(
+ 'Home',
+ 'Label for a link that points at the website home, home_url()'
+ ) }
>
diff --git a/packages/block-library/src/home-link/index.js b/packages/block-library/src/home-link/index.js
index 5bb3914bb1bf33..f00e3abfcba2a5 100644
--- a/packages/block-library/src/home-link/index.js
+++ b/packages/block-library/src/home-link/index.js
@@ -1,7 +1,6 @@
/**
* WordPress dependencies
*/
-import { _x } from '@wordpress/i18n';
import { home } from '@wordpress/icons';
/**
@@ -23,8 +22,6 @@ export const settings = {
save,
example: {
- attributes: {
- label: _x( 'Home Link', 'block example' ),
- },
+ attributes: {},
},
};
diff --git a/packages/block-library/src/home-link/index.php b/packages/block-library/src/home-link/index.php
index eafd27461c0972..c43fd5ad2db316 100644
--- a/packages/block-library/src/home-link/index.php
+++ b/packages/block-library/src/home-link/index.php
@@ -121,43 +121,14 @@ function block_core_home_link_build_li_wrapper_attributes( $context ) {
* @return string Returns the post content with the home url added.
*/
function render_block_core_home_link( $attributes, $content, $block ) {
- if ( empty( $attributes['label'] ) ) {
- return '';
- }
$wrapper_attributes = block_core_home_link_build_li_wrapper_attributes( $block->context );
-
- $html = ' array(),
- 'em' => array(),
- 'img' => array(
- 'scale' => array(),
- 'class' => array(),
- 'style' => array(),
- 'src' => array(),
- 'alt' => array(),
- ),
- 's' => array(),
- 'span' => array(
- 'style' => array(),
- ),
- 'strong' => array(),
- )
- );
- }
-
- $html .= '';
+ $html = sprintf(
+ '%3$s',
+ $wrapper_attributes,
+ esc_url( home_url() ),
+ _x( 'Home', 'Label for a link that points at the website home, home_url().' )
+ );
return $html;
}
diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.html b/packages/e2e-tests/fixtures/blocks/core__home-link.html
index e1564a33298ae6..17ae5dd3798a79 100644
--- a/packages/e2e-tests/fixtures/blocks/core__home-link.html
+++ b/packages/e2e-tests/fixtures/blocks/core__home-link.html
@@ -1 +1 @@
-
+
diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.json b/packages/e2e-tests/fixtures/blocks/core__home-link.json
index 1a2c5fc0c6c5d5..cc11e90f31f9b9 100644
--- a/packages/e2e-tests/fixtures/blocks/core__home-link.json
+++ b/packages/e2e-tests/fixtures/blocks/core__home-link.json
@@ -3,9 +3,7 @@
"clientId": "_clientId_0",
"name": "core/home-link",
"isValid": true,
- "attributes": {
- "label": "Home"
- },
+ "attributes": {},
"innerBlocks": [],
"originalContent": ""
}
diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json b/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json
index 7dee324f4fd40e..269add18b0d64b 100644
--- a/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json
+++ b/packages/e2e-tests/fixtures/blocks/core__home-link.parsed.json
@@ -1,9 +1,7 @@
[
{
"blockName": "core/home-link",
- "attrs": {
- "label": "Home"
- },
+ "attrs": {},
"innerBlocks": [],
"innerHTML": "",
"innerContent": []
diff --git a/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html b/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html
index e1564a33298ae6..17ae5dd3798a79 100644
--- a/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html
+++ b/packages/e2e-tests/fixtures/blocks/core__home-link.serialized.html
@@ -1 +1 @@
-
+