Skip to content

Instantly share code, notes, and snippets.

@gmmedia
Last active August 4, 2022 12:49
Show Gist options
  • Save gmmedia/c8bafed669dcf76a80a9a17f01e21682 to your computer and use it in GitHub Desktop.
Save gmmedia/c8bafed669dcf76a80a9a17f01e21682 to your computer and use it in GitHub Desktop.
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