Skip to content

Commit b86cbe2

Browse files
committed
Documentation: Clarifies how to assign a template to a default Post Type
1 parent 513534d commit b86cbe2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/templates.md

+14
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,17 @@ Sometimes the intention might be to lock the template on the UI so that the bloc
6868

6969
- `all` — prevents all operations.
7070
- `insert` — prevents inserting new blocks, but allows moving existing ones.
71+
72+
## Default Post Types
73+
74+
It is also possible to assign a template to a default post type like "posts" and "pages":
75+
76+
```php
77+
$post_type_object = get_post_type_object( 'post' );
78+
$post_type_object->template = array(
79+
array( 'core/paragraph', array(
80+
'placeholder' => 'Add Description...',
81+
) ),
82+
);
83+
$post_type_object->template_lock = 'all';
84+
```

0 commit comments

Comments
 (0)