[wp-trac] [WordPress Trac] #46264: Page attributes 'ORDER' does not saving data for post-type 'post'.
WordPress Trac
noreply at wordpress.org
Sun Mar 24 19:35:24 UTC 2019
#46264: Page attributes 'ORDER' does not saving data for post-type 'post'.
----------------------------------------+------------------------------
Reporter: tanvirul | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 5.0
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests | Focuses:
----------------------------------------+------------------------------
Changes (by felipeelia):
* keywords: needs-patch => has-patch needs-unit-tests
Comment:
Hi @tanvirul and welcome to WordPress trac :)
You shouldn't hook your function to `admin_init`, but to `init`. Anyway, I
was able to reproduce the problem you reported.
That seems to happen because, for posts, pages, and attachments, the JSON
Schema generated by `WP_REST_Posts_Controller::get_item_schema()` is
restricted by the `$fixed_schemas` variable. That said, the `menu_order`
field is never exposed to the Rest API.
I've uploaded a patch that uses `$fixed_schemas` for default attributes,
but still checks if those post types support other attributes. Perhaps we
should remove `$fixed_schemas` at all, and always check this dynamically,
but I guess it was there for a reason, so let's wait for somebody else
input here.
Also, for the Tests suite, I think we should probably move/copy
`test_update_page_menu_order_*` functions from
`WP_Test_REST_Pages_Controller` to use them for all post types (custom or
not). But, again, someone more experienced may have better input for this.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46264#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list