Title: not working &#8211; multisite
Last modified: August 22, 2016

---

# not working – multisite

 *  Resolved [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/not-working-multisite/)
 * I just installed your plugin and entered a snippet with this function:
 *     ```
       function my_custom_menu_item( $items, $args ) {
           if ( function_exists ( 'the_msls' ) && 'Primary Navigation' == $args->theme_location ) {
               $obj = new MslsOutput;
               $arr = $obj->get( 2 );
               if ( !empty( $arr ) ) {
                   $items .= '<li>' . implode( '</li><li>', $arr ) . '</li>';
               }
           }
   
           return $items;
       }
       add_filter( 'wp_nav_menu_items', 'my_custom_menu_item', 10, 2 );
       ```
   
 * but wordpress collapsed with this message:
 * > Fatal error: Cannot redeclare my_custom_menu_item() (previously declared in/
   > web/htdocs/www.spinips.com/home/wp-content/plugins/functions.php:13) in /web/
   > htdocs/www.spinips.com/home/wp-content/plugins/code-snippets/code-snippets.
   > php(1103) : eval()’d code on line 11
 * I found then your instruction for safe mode, but I still don’t understand why
   it crashed, since I used that function for my previous theme (without multisite).
   Any suggestion?

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

 *  Thread Starter [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/not-working-multisite/#post-5269206)
 * And maybe this is a stupid question, but how can I be sure to have fixed the 
   function and that this function is working good if I’m in safe mode?
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/not-working-multisite/#post-5269228)
 * The error occurs because you have the exact same code in a snippet as in your
   functions.php. PHP requires function names to be unique, so you cannot have the
   same one twice.
 * You can fix the error by renaming the function:
 *     ```
       function my_custom_menu_item_unique( $items, $args ) {
           if ( function_exists ( 'the_msls' ) && 'Primary Navigation' == $args->theme_location ) {
               $obj = new MslsOutput;
               $arr = $obj->get( 2 );
               if ( !empty( $arr ) ) {
                   $items .= '<li>' . implode( '</li><li>', $arr ) . '</li>';
               }
           }
   
           return $items;
       }
       add_filter( 'wp_nav_menu_items', 'my_custom_menu_item_unique', 10, 2 );
       ```
   
 * After you have updated the code, simply disable safe mode and activate the snippet
   to check if it works.
 *  Thread Starter [spinips](https://wordpress.org/support/users/spinips/)
 * (@spinips)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/not-working-multisite/#post-5269272)
 * Thank you, fixed! Although the function hasn’t got the wished effect…

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

The topic ‘not working – multisite’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

## Tags

 * [fatal error](https://wordpress.org/support/topic-tag/fatal-error/)
 * [multisite](https://wordpress.org/support/topic-tag/multisite/)

 * 3 replies
 * 2 participants
 * Last reply from: [spinips](https://wordpress.org/support/users/spinips/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/not-working-multisite/#post-5269272)
 * Status: resolved