[wp-trac] [WordPress Trac] #45250: Block editor scripts should be enqueued in an action hooked to `admin_enqueue_scripts` as done in Gutenberg (was: Backward compatibility: Impossible to prefill a new post in WP 5.0)

WordPress Trac noreply at wordpress.org
Thu Nov 22 14:29:36 UTC 2018


#45250: Block editor scripts should be enqueued in an action hooked to
`admin_enqueue_scripts` as done in Gutenberg
--------------------------+---------------------
 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:
--------------------------+---------------------
Changes (by Chouby):

 * keywords:  has-patch reporter-feedback => has-patch


Comment:

 @pento Thank you for the suggestion. I am not sure to remember but it's
 possible that I never used this filter because the first data that I
 prefilled were custom fields, long before `$meta_input` was added to
 `$postarr`. But your suggestion may be a very good solution to unify my
 code for both editors. For sure, I will look at it.

 For now I already have a working workaround, using the suggestion from
 @danielbachhuber and the action `rest_api_init` to replace `add_metaboxes`
 when using the block editor.

 However, I did not close the ticket because I still believe that the
 difference of behavior between WP 4.9.8 + Gutenberg on one side and WP 5.0
 on the other side is disturbing, although I am not sure if someone else
 than me would be disturbed. That's why I proposed the patch to enqueue the
 scripts in a function hooked to `admin_enqueue_scripts` as done in
 Gutenberg.

 I am changing the title to reflect this.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45250#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list