On this page
wp_ajax_menu_locations_save()
Ajax handler for menu locations save.
Source
File: wp-admin/includes/ajax-actions.php. View all references
function wp_ajax_menu_locations_save() {
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( -1 );
}
check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
if ( ! isset( $_POST['menu-locations'] ) ) {
wp_die( 0 );
}
set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
wp_die( 1 );
}
Related
Uses
| Uses | Description |
|---|---|
| set_theme_mod() wp-includes/theme.php | Updates theme modification value for the active theme. |
| current_user_can() wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| check_ajax_referer() wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| wp_die() wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_ajax_menu_locations_save