I can confirm that this filter applied with 3 parameters as you mentioned in your snippet. The warning is very strange and shouldn’t appear if WordPress core wan’t hacked.
The best practice for this case is to request parameters, which are required by your hook. So if you don’t use $args
, so don’t request it:
add_filter( 'nav_menu_css_class', 'wbwcrf_nav_menu_css_class', 10, 2 );
function wbwcrf_nav_menu_css_class( $classes, $item )
{
// ...
}
Another approach is to set default values for income arguments:
add_filter( 'nav_menu_css_class', 'wbwcrf_nav_menu_css_class', 10, 3 );
function wbwcrf_nav_menu_css_class( $classes, $item, $args = array() )
{
// ...
}
Related Posts:
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- How can I edit post data before it is saved?
- How to only hook on Single.php after content?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- Edit plugin without hooks in functions.php
- Filter Hook on plugin update
- Hide WordPress Plugin Deactivation Links
- Use external link in the add sub menu
- Pass A Value From Outside To A Plugin Variable
- Failed to invoke other hook from the init hook
- do_action and hook methods
- How can I filter blog name?
- why does the add_action(‘the_content’) overwrite my page
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- plugin_action_links_{$plugin_file} hook not in the main plugin file
- Woocommerce Shipping module available only for type of products [closed]
- Determine plugin name from within plugin_action_links filter
- merging an array to an existing array using add_filter
- Reposition Woocommerce Message
- Randomize attachment IDs
- Third level navigation class
- Pass info from functions.php to plugin
- Change permalink structure hidden button edit
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- Inserting above the comment template
- Modifying the comments section through a plugin regardless of theme
- How to get the element ID from new menu list that added with add_filter()?
- Get Time Taken By Each Action Hook in WordPress
- Filtering WooCommerce Orders by Category
- Redirect to another page using contact form 7? [closed]
- Template filter for custom taxonomy terms
- Add sub menu page in your plugin
- What exactly happens to function argument availability when using a filter?
- remove_action not removing add_action from constructor
- How to get menu location in wp_update_nav_menu hook
- How to use the pre_option filter before a plugin loads?
- How to use filter to disable adding a product to wishlist?
- WordPress: Add custom add_filter for custom functions
- Hook for altering the content of all wp mails
- Hook on creating a menu entry?
- How to hook into action/filter call
- Use a hook or filter, or overwrite this Gamipress function?
- Add hook after content without formatting
- Unpublished Pages Failing To Appear On Custom Path
- Randomize post (and page) IDs on generation
- Plugin function in child theme
- Use action, filter, or hook to append HTML to WordPress plugin function
- Customize plugin templates
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- Admin page and admin menu. Permissions plugin
- Passing a parameter to filter and action functions
- change output location of plugin function using a custom hook
- add query string to all pages after user logged in
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- How to Add Extra Text In WordPress Title Before Post Publish
- Change social icon in twenty twenty three theme
- Customize WP Filter Hook
- Hook (or other way) to find out when another plugin is activated / installed
- Any hook for pre-plugin-update -either bulk or single plugin update
- Is there an earlier hook than login_head or login_enqueue_scripts?
- Add custom message to the plugins page of WordPress
- Gravity Forms plugin: How to use “gform_editor_js” action hook? [closed]
- Edit default comments page in WP Admin
- Insert new user with form submit ‘init’ hook
- Creating a plugin to sanitize comment and the url field before display only
- How do I display only the latest post on my home page, while maintaining proper plugin hooks?
- Creating a nav menu
- wp_list_pages() but only show children on the branch you are on
- How to find the origin of a file upload from within wp_handle_upload?
- Hooking in to replace the Sidebar/Widget areas
- How to get all of the activate_plugin action parameters?
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Easiest way to add dropdown to a page
- Using a post-signup hook to get user details
- Map a custom id to wordpress post id
- woocommerce_package_rates not fired when wordpress woocommerce accessed as non ajax
- Trigger Elementor Popup via code [closed]
- wp_get_post_terms is difference obj model than the one in rest api response
- Calling plugin function inside custom plugin for onclick event
- White page by using filter template_include
- How to check current user before all actions and filters?
- How do I create a filter feature on WordPress? [closed]
- get current date + 90 days and checking every day
- Create a navbar filter that filters by a custom field
- Merging Two menus in the backend into one menu
- Passing an array from shortcode-function to filter-function
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- How to add an arrow to menu items has submenus
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Best place for short bio,image and button [closed]
- How to remove plugin metaboxes from edit.php
- Plugin developer automated documentation
- qTranslate remove default directory from link
- How to disable a plugin for certain page?
- Output content to the_content before a plugin does
- Is there a hook to Intercept al urls from a webpage and redirect to a page
- Delete mobile menu button [closed]
- html generated by theme exist but doesnt appear in browser