Skip to content

Instantly share code, notes, and snippets.

@gmmedia
Last active Aug 4, 2022
Embed
What would you like to do?
WP Glossary - Add Gutenberg Support
<?php
// WP Glossary - Add Gutenberg Support
// Need help: https://bloggerpilot.com/snippet-wp-glossary-gutenberg/
// Add support for Gutenberg
add_filter ( 'wpg_post_type_glossary_args', 'bp_wpg_post_editor' );
function bp_wpg_post_editor ( $args ) {
$args['show_in_rest'] = true; // for Gutenberg Editor
return $args;
}
// Add support for taxomonies in Gutenberg
add_filter ( 'register_taxonomy_args', 'bp_taxonomy_args', 10, 2 );
function bp_taxonomy_args( $args, $taxonomy_name ) {
if ( 'glossary_cat' === $taxonomy_name ) {
$args['show_in_rest'] = true;
}
if ( 'glossary_tag' === $taxonomy_name ) {
$args['show_in_rest'] = true;
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment