/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/e2e-tests/plugins/meta-box.php
48 строк
1 KB
Ella
Editor: leave undo to the browser in fields that handle their own undo (#80768)
29 июл 2026, 13:19
Не верифицирован
29 июл 2026, 13:19
b9d5bdd
Код
Авторство
О чём код?
<?php /** * Plugin Name: Gutenberg Test Plugin, Meta Box * Plugin URI: https://github.com/WordPress/gutenberg * Author: Gutenberg Team * * @package gutenberg-test-meta-box */ /** * Prints string for meta box */ function gutenberg_test_meta_box_render_meta_box() { echo 'Hello World'; echo '<label for="gutenberg_test_meta_box_input">Test meta box field</label>'; echo '<input type="text" id="gutenberg_test_meta_box_input" name="gutenberg_test_meta_box_input" />'; } /** * Add a test meta box */ function gutenberg_test_meta_box_add_meta_box() { add_meta_box( 'gutenberg-test-meta-box', 'Gutenberg Test Meta Box', 'gutenberg_test_meta_box_render_meta_box', 'post', 'normal', 'high' ); } add_action( 'add_meta_boxes', 'gutenberg_test_meta_box_add_meta_box' ); /** * Print excerpt in <meta> tag in wp_head * @global WP_Post $post Global post object. */ function gutenberg_test_meta_box_render_head() { global $post; setup_postdata( $post ); // Emulates what plugins like Yoast do with meta data on the front end. // Tests that our excerpt processing does not interfere with dynamic blocks. $excerpt = wp_strip_all_tags( get_the_excerpt() ); ?> <meta property="gutenberg:hello" content="<?php echo esc_attr( $excerpt ); ?>" /> <?php } add_action( 'wp_head', 'gutenberg_test_meta_box_render_head' );