Title: Fatal error: Uncaught TypeError implode()
Last modified: April 21, 2023

---

# Fatal error: Uncaught TypeError implode()

 *  Resolved [andom75](https://wordpress.org/support/users/andom75/)
 * (@andom75)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-implode/)
 * Don’t know if this might be a bug of wordpress or I do somthing wrong. I have
   created a standard theme. Works well so far. When it comes to adding a menu through
   a sidebar I get this warning.
 * **Fatal error**: Uncaught TypeError: implode(): Argument #1 ($pieces) must be
   of type array, string given in /[path]/wp-includes/class-walker-nav-menu.php:
   158
 * Environment:
   WP 6.2PHP: 8.0
 * In order to get rid the warning I have change the line 158 in the class-walker-
   nav-menu.php:158 as shown below.
 *     ```wp-block-code
       //	$class_names = implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $menu_item, $args, $depth ) );
       		$class_names = '';
       		$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
       ```
   
 * What I did to achive rendering a menu in the footer:
   I have registered a sidebar
 *     ```wp-block-code
       register_sidebar(
            array(
             'name' => esc_html__( 'Anywear Footer About', 'anywear'),
              'id' => 'anywear-footer-about',
             'class' => 'anywear-footer-about',
              'description' => 'AnyWear Dynamic Footer About Area',
             'before_widget' => '<section id="%1$s" class="anywear-footer-about-widget %2$s">',
              'after_widget' => '</section>',
              'before_title' => '<h2 class="anywear-footer-about-widget-title">',
              'after_title' => '</h2>'
            )
          );
       ```
   
 * created the related sidebar.php
 *     ```wp-block-code
       if (!is_active_sidebar('anywear-footer-about')){
   
         return;
   
       } else {
   
         dynamic_sidebar('anywear-footer-about');
   
       }
       ```
   
 * added the sidbar to the footer.php
 *     ```wp-block-code
       <?php get_sidebar('anywear-footer-about');?>
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffatal-error-uncaught-typeerror-implode%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-implode/#post-16677591)
 * For me in the test with the information from you, I can not understand.
 * Are you using the “nav_menu_css_class” filter at any point?
 * Let’s output what
 *     ```wp-block-code
       apply_filters( 'nav_menu_css_class', array_filter( $classes ), $menu_item, $args, $depth )
       ```
   
 * generates (e.g. via var_dump()). I guess only a string comes out here, but it
   should be an array. If so, take a closer look at the values of the individual
   parameters.
 *  Thread Starter [andom75](https://wordpress.org/support/users/andom75/)
 * (@andom75)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-implode/#post-16678104)
 * Beg your pardon, yes your were right I had a filter in order to add custom classes.
   Have removed the filter and suddenly no warnings anymore.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fatal error: Uncaught TypeError implode()’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [andom75](https://wordpress.org/support/users/andom75/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-implode/#post-16678104)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
