Plugin: Populate demo content by default content filters #13553
Merged
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.
This pull request seeks to move handling of the demo content initialization from
gutenberg_editor_scripts_and_styles
to separate filter handlers in a new file dedicated for demo supports (one of the few PHP extensions Gutenberg will offer atop core from the initial 5.0 release). The reason for this change is to facilitate the removal ofgutenberg_editor_scripts_and_styles
. Core doesn't otherwise allow for filtering of the$initial_edits
it generates for editor initialization, but these can be alternatively provided through thedefault_content
anddefault_title
filters run byget_default_post_to_edit
(the function responsible for generating a new post to edit).Testing instructions:
Verify that the Gutenberg demo content is shown for a new post created via Gutenberg > Demo.
Verify that Gutenberg demo content is not shown for a new post created via Posts > Add New.
Verify that Gutenberg content is not considered even if manually adding a
&gutenberg-demo
query argument to the URL of any edited post.