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
- How do I exclude plugins from getting automatically updated?
- Schedule WordPress Auto-Updates to only run during business hours
- Remove action from plugin on other plugin
- plugin_action_links Filter Hook Deprecated?
- WordPress Hook that will run when media file deleted
- Generic plugin (de)activation hook?
- How to make a plugin auto-add item to nav menu
- Is it possible to remove this action? (as it’s added just before it’s called)
- There’s some way to add a wrapper around posted images?
- ‘wp_login’ action hook not working with wp-login.php file
- When to call add_filter
- Where (or when) should I register a new taxonomy?
- Hook (or other way) to find out when another plugin is activated / installed
- 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
- qTranslate remove default directory from link
- edit_user_profile and show_user_profile are not firing inside a class
- Combining several CSS files into one for optimization
- How do I add some javascript validation to the admin interface form’s onsubmit?
- Hook for page Request?
- How to remove js ui library added by default by wordpress
- How to remove a class function from a plugin by using remove_action()?
- profile_update hook doesn’t works inside a class
- Need to revert to an older version of wordpress
- What hook can I use to modify custom post data before it is displayed on the page?
- How to deactivate my plugin upon deactivation of NextGen
- apply_filters(woocommerce_get_item_data, …) Causing errors when adding to cart
- Why does “updated_post_meta” did not fire when uploading media other than image?
- Change Dashboard URL from wp-admin to wp-admin/index.php
- post title not changing at post page
- Using OR Condition with facetwp facets
- Redirect to a page while maintaining search query parameters without causing an infinite loop
- jquery plugin won’t fire when hamburger class element clicked
- What action or filter can I use to change all the html returned from server for a page?
- Hook on widget context plugin to add custom context for widget
- Power Menus plugin destroys menu after adding new item
- trying to create simple plugin to filter categories from all authors
- Which filters or actions involve with index page for plugin?
- How to display a link in the footer section
- WP Members additional fields on user profile [closed]
- Suitable hook when creating, updating and deleting posts programmatically
- How to add product thumbnail on orders list on backend?