[wp-trac] [WordPress Trac] #58910: Reconsider wp_add_fields_to_navigation_fallback_embedded_links() location
WordPress Trac
noreply at wordpress.org
Wed Jul 26 11:20:32 UTC 2023
#58910: Reconsider wp_add_fields_to_navigation_fallback_embedded_links() location
----------------------------+--------------------
Reporter: SergeyBiryukov | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.3
Component: Editor | Version: trunk
Severity: normal | Keywords:
Focuses: rest-api |
----------------------------+--------------------
[56052] / #58557 added the [source:trunk/src/wp-includes/navigation-
fallback.php?rev=56296 wp-includes/navigation-fallback.php] file with a
single function,
`wp_add_fields_to_navigation_fallback_embedded_links()`.
At a glance, adding a separate file for only one function like that is not
something that WP core generally does. In a discussion with @aristath, it
looks like this was directly copied from the Gutenberg plugin, and might
need to be rearchitected properly for core. The `add_filter()` call should
probably be moved to `default-filters.php`, and there might be a more
appropriate location for the function itself as well.
I wonder if that function should instead be a method of the
`WP_REST_Navigation_Fallback_Controller` class, or if
`register_rest_field()` should be used for those extra properties, so that
`::add_additional_fields_schema()` works for them.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58910>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list