Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API: Audit menus route filters. #25095

Closed
Tracked by #29102
TimothyBJacobs opened this issue Sep 5, 2020 · 1 comment · Fixed by #34857
Closed
Tracked by #29102

REST API: Audit menus route filters. #25095

TimothyBJacobs opened this issue Sep 5, 2020 · 1 comment · Fixed by #34857
Labels
REST API Interaction Related to REST API

Comments

@TimothyBJacobs
Copy link
Member

We need to make sure that menus and menu items are having the correct filters applied when being saved.

Something that stood out to me was the _save_pre filters in prepare_item_for_database,

$prepared_nav_item['menu-item-title'] = wp_unslash( apply_filters( 'title_save_pre', wp_slash( $prepared_nav_item['menu-item-title'] ) ) );
. To me it looks like those filters are duplicates, since they will eventually be applied when wp_insert_post calls sanitize_post. The wp_update_nav_menu_item function does takes care of moving menu-item-title and friends into their correct variable names for wp_insert_post. Of note, we don't apply these filters in the base WP_REST_Posts_Controller class.

There may be other instances, but I didn't find any in a cursory glance. It'd be good to have another set of eyes or two to look over the code path as well.

@spacedmonkey
Copy link
Member

The lines are copied from here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REST API Interaction Related to REST API
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants