[wp-trac] [WordPress Trac] #58910: Reconsider wp_add_fields_to_navigation_fallback_embedded_links() location

WordPress Trac noreply at wordpress.org
Thu Aug 3 05:02:08 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                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+-----------------------

Comment (by ramonopoly):

 > Then I guess we should answer whether to create a new file and where it
 should live 👍

 If we don't want to extend `WP_REST_Posts_Controller`, what about adding
 the hook as a public method of `WP_Navigation_Fallback`?


 {{{
 add_filter( 'rest_wp_navigation_item_schema', array(
 'WP_Navigation_Fallback', 'update_wp_navigation_post_schema' ), 22 );
 }}}

 Nothing else would need to change, except for maybe the comments and
 function name, which I still consider a bit misleading. That is, the
 effect is for all wp_navigation post types but used specifically in
 `WP_REST_Navigation_Fallback_Controller`.

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


More information about the wp-trac mailing list