[wp-trac] [WordPress Trac] #45250: Backward compatibility: Impossible to prefill a new post in WP 5.0
WordPress Trac
noreply at wordpress.org
Thu Nov 1 12:44:04 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: reporter-feedback | Focuses:
-------------------------------+---------------------
Comment (by danielbachhuber):
> Now, filtering the REST response would work for the fields such as
`menu_order` as you tested it, but it would not work for the title,
content and excerpt. That means that Gutenberg/WP 5.0 introduces some
inconsistent behavior. Some fields need to be filtered in the REST
response and some other using the global `$post` variable (or the filters
`default_content`, `default_excerpt` and `default_title` which in fact
have always and are still just an indirect way to modify only 3 properties
of the global variable).
Ugh.
> Is there a way to know if the REST request is coming from the blocks
editor and not from anywhere outside?
Not in precise manner, no. `$pagenow` is likely the best indicator you
have.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45250#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list