Skip to content

Commit

Permalink
Use the core/editor store in WordPress 6.5 and later.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Jul 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 704063f commit f5e1b2a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/TaxonomyAdmin.php
Original file line number Diff line number Diff line change
@@ -329,11 +329,14 @@ public function meta_boxes( string $object_type, $object ): void {
remove_meta_box( "tagsdiv-{$this->taxo->taxonomy}", $post_type, 'side' );
}

$store = version_compare( $GLOBALS['wp_version'], '6.5', '>=' ) ? 'core/editor' : 'core/edit-post';

# Remove default meta box from block editor:
wp_add_inline_script(
'wp-edit-post',
sprintf(
'wp.data.dispatch( "core/edit-post" ).removeEditorPanel( "taxonomy-panel-%s" );',
'wp.data.dispatch( "%s" ).removeEditorPanel( "taxonomy-panel-%s" );',
$store,
$this->taxo->taxonomy
)
);

0 comments on commit f5e1b2a

Please sign in to comment.