mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-16 19:46:21 +00:00
Don't store nonexistent (deleted) menus in the auto-add option. see #13447.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
aac7b130c0
commit
c0289daf99
@ -368,6 +368,8 @@ switch ( $action ) {
|
|||||||
if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
|
if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
|
||||||
unset( $nav_menu_option['auto_add'][$key] );
|
unset( $nav_menu_option['auto_add'][$key] );
|
||||||
}
|
}
|
||||||
|
// Remove nonexistent/deleted menus
|
||||||
|
$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
|
||||||
update_option( 'nav_menu_options', $nav_menu_option );
|
update_option( 'nav_menu_options', $nav_menu_option );
|
||||||
|
|
||||||
wp_defer_term_counting(false);
|
wp_defer_term_counting(false);
|
||||||
|
@ -765,7 +765,9 @@ function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ( $auto_add as $menu_id ) {
|
foreach ( $auto_add as $menu_id ) {
|
||||||
$items = (array) wp_get_nav_menu_items( $menu_id );
|
$items = wp_get_nav_menu_items( $menu_id );
|
||||||
|
if ( ! is_array( $items ) )
|
||||||
|
continue;
|
||||||
foreach ( $items as $item ) {
|
foreach ( $items as $item ) {
|
||||||
if ( $post->ID == $item->object_id )
|
if ( $post->ID == $item->object_id )
|
||||||
continue 2;
|
continue 2;
|
||||||
|
@ -714,7 +714,7 @@ function get_term_to_edit( $id, $taxonomy ) {
|
|||||||
*
|
*
|
||||||
* The 'get_terms_orderby' filter passes the ORDER BY clause for the query
|
* The 'get_terms_orderby' filter passes the ORDER BY clause for the query
|
||||||
* along with the $args array.
|
* along with the $args array.
|
||||||
|
*
|
||||||
* The 'get_terms_fields' filter passes the fields for the SELECT query
|
* The 'get_terms_fields' filter passes the fields for the SELECT query
|
||||||
* along with the $args array.
|
* along with the $args array.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user