diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 99deacc22b..a16f123074 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -1264,10 +1264,21 @@ function wp_page_menu( $args = array() ) { $list_args['title_li'] = ''; $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) ); + $container = sanitize_text_field( $args['container'] ); + if ( $menu ) { + + // wp_nav_menu doesn't set before and after + if ( isset( $args['fallback_cb'] ) && + 'wp_page_menu' === $args['fallback_cb'] && + 'ul' !== $container ) { + $args['before'] = '