Skip to content

Commit

Permalink
Merge pull request #80 from pantheon-systems/feature/unlock-native-wp…
Browse files Browse the repository at this point in the history
…-editor

Feature | Unlock the Native WordPress Editor
  • Loading branch information
bafi authored Aug 27, 2024
2 parents a8da33a + 01cba9a commit b195e2e
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions app/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ private function addHooks(): void
add_action('admin_menu', [$this, 'pluginAdminNotice']);
add_filter('post_row_actions', [$this, 'addRowActions'], 10, 2);
add_filter('page_row_actions', [$this, 'addRowActions'], 10, 2);
add_action('admin_init', [$this, 'preventPostEditing']);
add_filter('wp_list_table_class_name', [$this, 'overrideAdminWPPostsTable']);
add_filter('the_content', [$this, 'addPreviewContainer']);
add_filter('admin_init', [$this, 'verifyCollectionUrl']);
Expand Down Expand Up @@ -238,28 +237,6 @@ public function registerPantheonCloudStatusEndpoint()
}
}

/**
* Prevent editing of PCC posts.
*
* @return void
*/
public function preventPostEditing(): void
{
global $pagenow;
// Check if the current page is the post/page edit page
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ($pagenow == 'post.php' && isset($_GET['post']) && 'edit' === strtolower($_GET['action'])) {
// phpcs:ignore
$documentId = get_post_meta(intval($_GET['post']), PCC_CONTENT_META_KEY, true);
if (!$documentId) {
return;
}

wp_redirect($this->buildEditDocumentURL($documentId));
die(200);
}
}

/**
* Build the Google Docs edit URL.
*
Expand Down Expand Up @@ -328,10 +305,6 @@ class="pcc-sync" data-id="%d" target="_blank">%s</a>',

$actions = array_merge($customActions, $actions);

if (isset($actions['edit'])) {
unset($actions['edit']);
}

if (isset($actions['inline hide-if-no-js'])) {
unset($actions['inline hide-if-no-js']);
}
Expand Down

0 comments on commit b195e2e

Please sign in to comment.