Title: Remove div from menu
Last modified: August 21, 2016

---

# Remove div from menu

 *  [rafaht](https://wordpress.org/support/users/rafaht/)
 * (@rafaht)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/remove-div-from-menu/)
 * Hi,
    I have a personalized theme and use HTML5. In validator, the div tag isn’t
   allowed with as a child of element ul and I try to remove this with the options
   and the PHP function and isn’t worked. I used regex to try this, but can’t work.
   The div appears on HTML, with the class option in blank. Can someone help me?
 *     ```
       <?php
       $menu = wp_page_menu(array(
       	'container' => '',
       	'container_class' => false,
       	'menu_class' => '',
       	'sort_column' => 'menu_order',
       	'exclude' => '5,9,23',
       	'show_home' => 1
       ));
       echo preg_replace( array( '#^<div[^>]*>#', '#</div>$#' ), '', $menu );
   
       ?>
       ```
   
 * Thanks,

The topic ‘Remove div from menu’ is closed to new replies.

## Tags

 * [div](https://wordpress.org/support/topic-tag/div/)
 * [function](https://wordpress.org/support/topic-tag/function/)
 * [html5](https://wordpress.org/support/topic-tag/html5/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [remove](https://wordpress.org/support/topic-tag/remove/)

 * 0 replies
 * 1 participant
 * Last reply from: [rafaht](https://wordpress.org/support/users/rafaht/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/remove-div-from-menu/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
