Created
December 9, 2025 23:42
-
-
Save SirLouen/04bf835b2a372f66407fbd9ec2eaf1a0 to your computer and use it in GitHub Desktop.
Testing GB Issue 73618
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://playground.wordpress.net/blueprint-schema.json", | |
| "login": true, | |
| "landingPage": "/wp-admin/edit.php?post_type=book", | |
| "steps": [ | |
| { | |
| "step": "writeFile", | |
| "path": "/wordpress/wp-content/mu-plugins/books-cpt.php", | |
| "data": "<?php\nadd_action( 'init', 'wp_learn_register_book_post_type' );\n/**\n * Register the book post type and its meta fields.\n *\n * @return void\n */\nfunction wp_learn_register_book_post_type() {\n\t$args = array(\n\t\t'labels' => array(\n\t\t\t'name' => 'Books',\n\t\t\t'singular_name' => 'Book',\n\t\t\t'menu_name' => 'Books',\n\t\t\t'add_new' => 'Add New Book',\n\t\t\t'add_new_item' => 'Add New Book',\n\t\t\t'new_item' => 'New Book',\n\t\t\t'edit_item' => 'Edit Book',\n\t\t\t'view_item' => 'View Book',\n\t\t\t'all_items' => 'All Books',\n\t\t),\n\t\t'public' => true,\n\t\t'has_archive' => true,\n\t\t'show_in_rest' => true,\n\t\t'rest_base' => 'books',\n\t\t'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ),\n\t\t'template' => array(\n\t\t\tarray( 'core/paragraph', array( 'placeholder' => 'Book content' ) ),\n\t\t\tarray(\n\t\t\t\t'core/columns',\n\t\t\t\tarray(),\n\t\t\t\tarray(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\tarray(),\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\tarray( 'core/paragraph', array( 'placeholder' => 'Author' ) ),\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\tarray(),\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'placeholder' => 'Author name',\n\t\t\t\t\t\t\t\t\t'metadata' => array(\n\t\t\t\t\t\t\t\t\t\t'bindings' => array(\n\t\t\t\t\t\t\t\t\t\t\t'content' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t'source' => 'core/post-meta',\n\t\t\t\t\t\t\t\t\t\t\t\t'args' => array( 'key' => 'author' ),\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t),\n\t\t\tarray(\n\t\t\t\t'core/columns',\n\t\t\t\tarray(),\n\t\t\t\tarray(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\tarray(),\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\tarray( 'core/paragraph', array( 'placeholder' => 'ISBN' ) ),\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tarray(\n\t\t\t\t\t\t'core/column',\n\t\t\t\t\t\tarray(),\n\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t'metadata' => array(\n\t\t\t\t\t\t\t\t\t\t'bindings' => array(\n\t\t\t\t\t\t\t\t\t\t\t'content' => array(\n\t\t\t\t\t\t\t\t\t\t\t\t'source' => 'core/post-meta',\n\t\t\t\t\t\t\t\t\t\t\t\t'args' => array( 'key' => 'isbn' ),\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t),\n\t\t\tarray( 'core/paragraph' ),\n\t\t),\n\t\t'template_lock' => 'insert',\n\t);\n\n\tregister_post_type( 'book', $args );\n\n\tregister_post_meta(\n\t\t'book',\n\t\t'isbn',\n\t\tarray(\n\t\t\t'single' => true,\n\t\t\t'type' => 'string',\n\t\t\t'show_in_rest' => true,\n\t\t\t'label' => __( 'ISBN', 'wp-learn-block-bindings' ),\n\t\t)\n\t);\n\n\tregister_post_meta(\n\t\t'book',\n\t\t'author',\n\t\tarray(\n\t\t\t'show_in_rest' => true,\n\t\t\t'single' => true,\n\t\t\t'type' => 'string',\n\t\t\t'label' => __( 'Author', 'wp-learn-block-bindings' ),\n\t\t)\n\t);\n}" | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment