Restore gutenberg_add_edit_link_for_post_type
filter.
#3159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The filter was added in 6884717, but then removed in bdf94e6. It's being added back because Gutenberg does not yet have support for advanced meta boxes, which many custom post types rely on.
Gutenberg should not be the default editor for post types which it does not fully support, because that leads to a poor user experience.
gutenberg_add_edit_link_for_post_type
isn't a good name for this filter, since it's true purpose is to prevent Gutenberg from doing anything with CPTs that opt-out of it. For the initial draft, though, I left it as-is in order to get feedback. One advantage of keeping it is that it preserves back-compat with sites that are already using it.It may also not be worth changing at this time, since I imagine a different solution will be desired by the time the plugin gets closer to the merge with Core. @BE-Webdesign suggested using
post_type_supports( 'block_editor' )
instead of a filter, which seems like a good idea to me, and would be a much more semantic solution. That would not necessarily mean that support would be off by default; Gutenberg could enable it by default, similar to how the REST API did.I'm happy to adjust the PR if y'all prefer that approach instead.
This also likely conflicts with #3146, but I'm happy to adapt this one if it's accepted after that one is merged.
Fixes #3158
Testing
wp-admin/edit.php
; theClassic Editor
link appears when hovering over an post in the listwp-admin/edit.php?post_type=wordcamp
; theClassic Editor
links should not appear when hovering over a post.