Skip to content

Commit 5dc0cc0

Browse files
Editor: Add excerpt support to the wp_block post type.
The purpose is to enable using the excerpt as a description for user-created patterns on the Site Editor Pattern screens. This commit backports the original PR from Gutenberg repository: * [[https://github.com/WordPress/gutenberg/pull/60549|#60549: [Data Views] User patterns: Use excerpt as description]] Reference: [[https://github.com/WordPress/gutenberg/issues/55244|#55244: Patterns: Add descriptions to user-created patterns]]. Follow-up to [44146], [44150], [50835], [56030]. Props poena, ntsekouras, krupalpanchal. Fixes #61250. git-svn-id: https://develop.svn.wordpress.org/trunk@58184 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e085371 commit 5dc0cc0

2 files changed

Lines changed: 108 additions & 0 deletions

File tree

src/wp-includes/post.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ function create_initial_post_types() {
328328
'map_meta_cap' => true,
329329
'supports' => array(
330330
'title',
331+
'excerpt',
331332
'editor',
332333
'revisions',
333334
'custom-fields',

tests/qunit/fixtures/wp-api-generated.js

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3879,6 +3879,40 @@ mockedApiResponse.Schema = {
38793879
},
38803880
"required": false
38813881
},
3882+
"excerpt": {
3883+
"description": "The excerpt for the post.",
3884+
"type": "object",
3885+
"properties": {
3886+
"raw": {
3887+
"description": "Excerpt for the post, as it exists in the database.",
3888+
"type": "string",
3889+
"context": [
3890+
"edit"
3891+
]
3892+
},
3893+
"rendered": {
3894+
"description": "HTML excerpt for the post, transformed for display.",
3895+
"type": "string",
3896+
"context": [
3897+
"view",
3898+
"edit",
3899+
"embed"
3900+
],
3901+
"readonly": true
3902+
},
3903+
"protected": {
3904+
"description": "Whether the excerpt is protected with a password.",
3905+
"type": "boolean",
3906+
"context": [
3907+
"view",
3908+
"edit",
3909+
"embed"
3910+
],
3911+
"readonly": true
3912+
}
3913+
},
3914+
"required": false
3915+
},
38823916
"meta": {
38833917
"description": "Meta fields.",
38843918
"type": "object",
@@ -3939,6 +3973,11 @@ mockedApiResponse.Schema = {
39393973
"default": "view",
39403974
"required": false
39413975
},
3976+
"excerpt_length": {
3977+
"description": "Override the default excerpt length.",
3978+
"type": "integer",
3979+
"required": false
3980+
},
39423981
"password": {
39433982
"description": "The password for the post if it is password protected.",
39443983
"type": "string",
@@ -4049,6 +4088,40 @@ mockedApiResponse.Schema = {
40494088
},
40504089
"required": false
40514090
},
4091+
"excerpt": {
4092+
"description": "The excerpt for the post.",
4093+
"type": "object",
4094+
"properties": {
4095+
"raw": {
4096+
"description": "Excerpt for the post, as it exists in the database.",
4097+
"type": "string",
4098+
"context": [
4099+
"edit"
4100+
]
4101+
},
4102+
"rendered": {
4103+
"description": "HTML excerpt for the post, transformed for display.",
4104+
"type": "string",
4105+
"context": [
4106+
"view",
4107+
"edit",
4108+
"embed"
4109+
],
4110+
"readonly": true
4111+
},
4112+
"protected": {
4113+
"description": "Whether the excerpt is protected with a password.",
4114+
"type": "boolean",
4115+
"context": [
4116+
"view",
4117+
"edit",
4118+
"embed"
4119+
],
4120+
"readonly": true
4121+
}
4122+
},
4123+
"required": false
4124+
},
40524125
"meta": {
40534126
"description": "Meta fields.",
40544127
"type": "object",
@@ -4379,6 +4452,40 @@ mockedApiResponse.Schema = {
43794452
},
43804453
"required": false
43814454
},
4455+
"excerpt": {
4456+
"description": "The excerpt for the post.",
4457+
"type": "object",
4458+
"properties": {
4459+
"raw": {
4460+
"description": "Excerpt for the post, as it exists in the database.",
4461+
"type": "string",
4462+
"context": [
4463+
"edit"
4464+
]
4465+
},
4466+
"rendered": {
4467+
"description": "HTML excerpt for the post, transformed for display.",
4468+
"type": "string",
4469+
"context": [
4470+
"view",
4471+
"edit",
4472+
"embed"
4473+
],
4474+
"readonly": true
4475+
},
4476+
"protected": {
4477+
"description": "Whether the excerpt is protected with a password.",
4478+
"type": "boolean",
4479+
"context": [
4480+
"view",
4481+
"edit",
4482+
"embed"
4483+
],
4484+
"readonly": true
4485+
}
4486+
},
4487+
"required": false
4488+
},
43824489
"meta": {
43834490
"description": "Meta fields.",
43844491
"type": "object",

0 commit comments

Comments
 (0)