Table of Contents
H0w to enable Gutenberg Editor for Sermons #
Introduction
Today we are going to show you how to enable the Gutenberg Editor for Advanced Sermons. With Gutenberg not being the most popular choice of WordPress users right now, we have choose to apply the classic editor to the custom post type sermons. However, to meet everyone’s needs we have created this online documentation to show how to enable the Gutenberg Editor if you wish to to set the Block Editor as the default for the sermon description content.
Placement
This code should be placed in the functions.php file of your active theme or a custom plugin. This allows you to update Advanced Sermons without loosing any of your custom modifications.
// Add REST API support to Advanced Sermons post type.
add_filter( 'register_post_type_args', 'asp_rest_post_type_args', 10, 2 );
function asp_rest_post_type_args( $args, $post_type ) {
if ( 'sermons' === $post_type ) {
$args['show_in_rest'] = true;
}
return $args;
}
// Add REST API support to Advanced Sermons taxonomies.
add_filter( 'register_taxonomy_args', 'asp_rest_taxonomy_args', 10, 2 );
function asp_rest_taxonomy_args( $args, $taxonomy_name ) {
if ( 'sermon_series' === $taxonomy_name || 'sermon_speaker' === $taxonomy_name || 'sermon_topics' === $taxonomy_name || 'sermon_book' === $taxonomy_name ) {
$args['show_in_rest'] = true;
}
return $args;
}