$accepted_args & add_filter()

[ad_1]

I’ve got some confusion around this parameter and how it actually functions.

Is it actually important if it matches the amount of variable the filter can accept – or – does it function as a maximum? Meaning if a filter has 4 possible parameters and you set 10 as the accepted_args, what’s the downside?

Obviously if you set too little it’ll give an error – but – it seems like it works if you go higher.

The only argument I could find online was related to rarely used core PHP functions and backwards compatibility.

Additionally, can you pick and choose your variables? Meaning if the filter lists $var1, $var2, and $var3 if I only wanted to modify $var3 would it be correct to leave the $accepted_args at 1 and then just pass function($var3) {}?

Thanks for the help!

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer