Я включил Гутенберга и пытаюсь создать шорткод на странице. Это мой код в functions.php
// Enable shortcodes in text areas
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');
// Enable shortcodes
add_filter( 'the_excerpt', 'shortcode_unautop');
add_filter( 'the_excerpt', 'do_shortcode');
function first_shortcode() {
$content = '<h1>This is my first shortcode</h1>';
return $content;
}
add_action('my_shortcode','first_shortcode');
В этом посте я поместил [my_shortcode] в раздел шорткодов, как показано ниже:
Но когда я показываю страницу, она просто отображает [my_shortcode]. Я использую Wordpress 4.9.8
Спасибо