Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use is_using_gutenberg() wrapper for use_block_editor_for_post(). #1056

Merged
merged 5 commits into from
May 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions includes/push-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Distributor\PushUI;

use Distributor\EnqueueScript;
use Distributor\Utils;

/**
* Setup actions and filters
Expand Down Expand Up @@ -38,6 +39,12 @@ function() {
* @return bool
*/
function syndicatable() {
// Retrieve the current global post, bail if not set.
$post = get_post();
if ( empty( $post ) ) {
return false;
}

/**
* Filter Distributor capabilities allowed to syndicate content.
*
Expand Down Expand Up @@ -79,14 +86,8 @@ function syndicatable() {
}
}

$post = get_post();

if ( empty( $post ) ) {
return;
}

// If we're using the classic editor, we need to make sure the post has a distributable status.
if ( ! use_block_editor_for_post( $post ) && ! in_array( $post->post_status, \Distributor\Utils\distributable_post_statuses(), true ) ) {
if ( ! Utils\is_using_gutenberg( $post ) && ! in_array( $post->post_status, Utils\distributable_post_statuses(), true ) ) {
return false;
}

Expand Down