Skip to content

Commit

Permalink
Fix: Gutenberg Plugin compatibility (elementor#7557)
Browse files Browse the repository at this point in the history
  • Loading branch information
bainternet committed Mar 20, 2019
1 parent d10ab05 commit 9674c1f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion includes/compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,20 @@ public static function register_actions() {
*/
public static function add_new_button_to_gutenberg() {
global $typenow;
if ( ! gutenberg_can_edit_post_type( $typenow ) || ! User::is_current_user_can_edit_post_type( $typenow ) ) {
if ( ! User::is_current_user_can_edit_post_type( $typenow ) ) {
return;
}

// Introduced in WP 5.0
if ( function_exists( 'use_block_editor_for_post' ) && ! use_block_editor_for_post( $typenow ) ) {
return;
}

// Deprecated/removed in Gutenberg plugin v5.3.0
if ( function_exists( 'gutenberg_can_edit_post_type' ) && ! gutenberg_can_edit_post_type( $typenow ) ) {
return;
}

?>
<script type="text/javascript">
document.addEventListener( 'DOMContentLoaded', function() {
Expand Down

0 comments on commit 9674c1f

Please sign in to comment.