Last active
August 4, 2022 12:49
-
-
Save gmmedia/c8bafed669dcf76a80a9a17f01e21682 to your computer and use it in GitHub Desktop.
WP Glossary - Add Gutenberg Support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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