What does (10, 2) mean when used with add_filter

Have a look at the codex page for add_filter.

The 10 is the $priority parameter (10 is default) which defines when your function will run in regards to the other functions which are attached to the nav_menu_css_class filter. 2 is the $accepted_args parameter which tells wordpress how many parameters the function you want to add will take. In this case your add_active_class function can take 2 parameters ($classes and $item).

Leave a Comment