[wp-trac] [WordPress Trac] #45250: Backward compatibility: Impossible to prefill a new post in WP 5.0
WordPress Trac
noreply at wordpress.org
Fri Nov 2 13:52:28 UTC 2018
#45250: Backward compatibility: Impossible to prefill a new post in WP 5.0
--------------------------+---------------------
Reporter: Chouby | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.0
Component: Editor | Version: 5.0
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+---------------------
Comment (by Chouby):
I see now that `edit-form-advanced.php` is also enqueuing scripts outside
the `admin_enqueue_scripts` action. I never paid attention to that.
To understand my issue to make Polylang work correctly with WP 5.0, you
should know that I often hook to the action `add_meta_boxes` to do various
things such as prefilling the content, create new content (taxonomy terms,
media), remove the editor for the translations of the posts page, or
manage compatibility with some plugins. I understand that all these things
were not the pimary goal of the action `add_meta_boxes` but with the
classic editor, `add_meta_boxes` is the first non-deprecated action after
the current `$post_ID` is known and before anything is loaded in the
editor.
With the current status of WP 5.0, the action `add_meta_boxes` is fired
after the content is preloaded via the REST API which breaks all the
features I hooked to this action. So I propose 2 alternatives to the
proposed patch.
1. Move the call to `register_and_do_post_meta_boxes( $post );` at the
beginning of `edit-form-advanced.php` still to restore the current
behavior of WP < 5.0 (even with Gutenberg) where the action is fired
before the content is loaded.
2. Add a new action after the `$post_ID` is known and before the content
is loaded. Ideally this new action should be avalaible in the 2 editors
for new and edited posts.
What do you think?
NB: I just created a related issue #45263 as the block editor now allows
to edit the posts page which is not the case with the classic editor. It's
related because I currently use the `add_meta_boxes` action to reproduce
the same behavior for the translations of the posts page.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45250#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list