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

Add 'gutenberg_can_edit_post' filter #6974

Closed
wants to merge 2 commits into from
Closed

Add 'gutenberg_can_edit_post' filter #6974

wants to merge 2 commits into from

Conversation

LZL0
Copy link

@LZL0 LZL0 commented May 28, 2018

Description

There was no way to disable / enable Gutenberg on a per-post basis. This can be very helpful to highly-customized sites which are running third-party or custom-made post editors. This filter can also be useful for plugins which affect / alter the publishing process.

Types of changes

Introduce 'gutenberg_can_edit_post' filter, a filter very comparable to the 'gutenberg_can_edit_post_type' filter.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

* @param bool $can_edit Whether the post can be edited or not.
* @param string $post The post being checked.
*/
return apply_filters( 'gutenberg_can_edit_post', $can_edit, $post );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is a duplicate of the replace_editor filter since Gutenberg is supposed to be used in all posts by default which means if you need to provide an alternative editor, you'd use the existing filter for that replace_editor instead of using a new filter with the same purpose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, noted. I wasn't aware of that.

@aduth
Copy link
Member

aduth commented Sep 13, 2018

As I understand the review, this is considered to be redundant with the replace_editor filter. Please reopen if I am not correct and that this still holds merit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants