Title: Debug Bar Reports Warning
Last modified: August 31, 2016

---

# Debug Bar Reports Warning

 *  Resolved [SooBahkDo](https://wordpress.org/support/users/soobahkdo/)
 * (@soobahkdo)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/debug-bar-reports-warning/)
 * Hello,
 * The search box is working and we added your code snippet to a child theme to 
   remove the submit button, but Debug bar is reporting the following:
 * WARNING: wp-includes/plugin.php:235 – call_user_func_array() expects parameter
   1 to be a valid callback, function ‘myslug_nav_search_form’ not found or invalid
   function name
    require(‘wp-blog-header.php’), require_once(‘wp-includes/template-
   loader.php’), include(‘/themes/customizr-pro/index.php’), do_action(‘__before_main_wrapper’),
   call_user_func_array, get_header, locate_template, load_template, require_once(‘/
   themes/customizr-pro/header.php’), do_action(‘__header’), call_user_func_array,
   TC_header_main->tc_navbar_display, apply_filters(‘tc_navbar_display’), call_user_func_array,
   TC_header_main->tc_new_menu_view, do_action(‘__navbar’), call_user_func_array,
   TC_menu->tc_menu_display, TC_menu->tc_regular_menu_display, TC_menu->tc_wp_nav_menu_view,
   wp_nav_menu, walk_nav_menu_tree, call_user_func_array, Walker->walk, TC_nav_walker-
   >display_element, Walker->display_element, call_user_func_array, TC_nav_walker-
   >start_el, Walker_Nav_Menu->start_el, apply_filters(‘walker_nav_menu_start_el’),
   call_user_func_array, Bop_Nav_Search_Box_Item->walker_nav_menu_start_el, apply_filters(‘
   bop_nav_search_show_submit_button’), call_user_func_array
 * Can this warning be fixed?
 * We did add your code snippet to child theme to remove the submit button.
 * function myslug_show_search_submit( $bool, $item, $depth, $args ){
    $bool = false;
   return $bool; } add_filter( ‘bop_nav_search_show_submit_button’, ‘myslug_nav_search_form’,
   10, 4 );
 * NOTE: Could you please consider making the presence or absence of the submit 
   button a user selectable option setting in a future release? Thanks!
 * [https://wordpress.org/plugins/bop-search-box-item-type-for-nav-menus/](https://wordpress.org/plugins/bop-search-box-item-type-for-nav-menus/)

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

 *  Plugin Author [joe_bopper](https://wordpress.org/support/users/joe_bopper/)
 * (@joe_bopper)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/debug-bar-reports-warning/#post-7289149)
 * Hi SooBahkDo,
 * Sorry for the error. It came from failing to fully adapt a copy-paste from another
   example. I have fixed it in the FAQs.
 * The issue is that the second argument of `add_filter` needs to be the name of
   the function that you want to be used. I.e., here you need to replace `myslug_nav_search_form`
   with `myslug_show_search_submit` to match the function name. Also, it is highly
   advisable to change `myslug_` to a short name of your theme (the same way that
   a large number of WordPress functions start with `wp_`) as it reduces the likelihood
   of conflicts with other copy-pasted code, and moreover, other themes, plugins,
   the core code, or even with PHP itself.
 * Hope this helps.
 * Cheers,
    Joe
 * P.S. The example now in the FAQs is a little neater in my opinion. It now uses
   an anonymous function which were unavailable until I dropped support for PHP 
   5.2 (n.b. this is nothing to be concerned about, 5.2 is very old and this plugin
   simply doesn’t run on unsuitable systems).
 *  Thread Starter [SooBahkDo](https://wordpress.org/support/users/soobahkdo/)
 * (@soobahkdo)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/debug-bar-reports-warning/#post-7289184)
 * Hello Joe_bopper,
 * I am confused.
 * I no longer see any code beginning with function in the FAQ — like this
 * function myslug_show_search_submit( $bool, $item, $depth, $args ){
    $bool = false;
   return $bool; } add_filter( ‘bop_nav_search_show_submit_button’, ‘myslug_nav_search_form’,
   10, 4 );
 * Can you provide the new snippet you described in your reply?
 * Thank you.
 *  Plugin Author [joe_bopper](https://wordpress.org/support/users/joe_bopper/)
 * (@joe_bopper)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/debug-bar-reports-warning/#post-7289223)
 * Hi SooBahkDo,
 * The reason it’s different is because I adjusted the FAQ to use [anonymous functions](http://php.net/manual/en/functions.anonymous.php)
   which were introduced in PHP 5.3 (the lowest version of PHP this plugin works
   with). I switched to these because it avoids clogging the functions namespace
   with names (and their associated bits of code) that are only ever intended to
   be used once.
 * If you use the piece of code that is currently in the FAQ of how to remove the
   the submit button instead of the all the code that was previously supplied, that
   should sort your issue.
 * Cheers,
    Joe
 * P.S. FYI, the way `add_filter` works is
 * `add_filter( $event_hook, $callable_function, $priority, $callables_args );`
 * where:
 * `$event_hook` is a string that is the reference name of the event in the flow
   of the code and a variable there that might want to be changed.
 * `$callable_function` is a callback input. In PHP, this means it can be a string,
   array, or an anonymous function. The reason the callback input can be so mixed
   is because, depending on context, each is the appropriate way of referencing 
   a function. The relevant contexts are detailed on [this page](http://php.net/manual/en/language.types.callable.php).
 * `$priority` is an integer that signifies the order that the callback functions
   should be called (the lower the sooner).
 * `$callback_args` is an integer signifying the number of arguments that should
   be passed to the $callable_function.
 * There also exists `add_action`, which is almost identical to `add_filter` except
   that it only attaches to a system event and has no expectation of a potential
   variable change. For this reason, `add_filter` expects its callback function 
   to end with `return $value_of_some_kind;`, whereas `add_action` doesn’t need 
   to return anything.
 * The major point in `add_filter` and `add_action` is to be able to run code at
   points in the default WordPress load without having to overwrite core files.
 *  Thread Starter [SooBahkDo](https://wordpress.org/support/users/soobahkdo/)
 * (@soobahkdo)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/debug-bar-reports-warning/#post-7289233)
 * Thanks Joe!
 * Works perfectly with no Debug Bar warnings. 🙂 Yipeeeeee

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

The topic ‘Debug Bar Reports Warning’ is closed to new replies.

 * ![](https://ps.w.org/bop-search-box-item-type-for-nav-menus/assets/icon-128x128.
   png?rev=1067133)
 * [Bop Search Box Item Type For Nav Menus](https://wordpress.org/plugins/bop-search-box-item-type-for-nav-menus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bop-search-box-item-type-for-nav-menus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bop-search-box-item-type-for-nav-menus/)
 * [Active Topics](https://wordpress.org/support/plugin/bop-search-box-item-type-for-nav-menus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bop-search-box-item-type-for-nav-menus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bop-search-box-item-type-for-nav-menus/reviews/)

## Tags

 * [debug warning](https://wordpress.org/support/topic-tag/debug-warning/)

 * 4 replies
 * 2 participants
 * Last reply from: [SooBahkDo](https://wordpress.org/support/users/soobahkdo/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/debug-bar-reports-warning/#post-7289233)
 * Status: resolved