#52189 closed enhancement (fixed)
Enable wp_update_nav_menu_item to use passed values for setting post_date
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | normal | Version: | 5.7 |
Component: | Menus | Keywords: | has-patch has-unit-tests commit has-dev-note |
Focuses: | Cc: |
Description
When a nav menu item is imported, it is given the post_date "now" rather than the value in the export file. There is currently no simple mechanism for setting the post_date for a nav menu item in wp_update_nav_menu_item, even though this value is useful for post_exists checks.
This change will allow the WordPress importer to pass the export file post_date value through wp_update_nav_menu_item, improving performance of post_exists for nav menu items.
This requires the new function resolve_post_date proposed in #52187.
Attachments (2)
Change History (12)
#4
@
4 years ago
- Keywords has-unit-tests added
52189.1.diff avoids insert failures and defaults to using "now", as previously wp_update_nav_menu_item would not fail because of a bad date. I've added unit tests to assert this behavior.
#5
@
4 years ago
- Keywords commit needs-dev-note added
- Owner set to audrasjb
- Status changed from new to accepted
I tested the patch and it looks good and relevant to me.
Indeed, it can be useful in some cases to get the post date, especially in custom nav menu walkers.
I'm marking this for commit
.
Also adding needs-dev-note
workflow keyword to make sure we don't forget to mention it in the Miscellaneous changes dev note :)
#8
@
4 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
It looks like the tests are introducing a phpcs error due to the usage of date
instead of gmdate
.
https://github.com/WordPress/wordpress-develop/runs/1759066474
Hi @jmdodd, Where I check the resolve_post_date function? I can't found this function in WordPress.