I am utilizing apply_filters to bridge the gap between plugins however am scuffling with the arguments. There may be one argument, an array, there are a number of implementations of add_filter to match apply_filters and every of them move down the unique array and add to it.
Appears which you can move a number of arguments from apply_filter however add_filter can solely return one argument, is that this right or how do you deal with a number of arguments between add_filter calls?
I have to move a second argument of an account ID, however it appears that evidently by precedence solely the primary add_filter will get to work with that argument. I plan to wrap up each arguments right into a single array and move that, so an array with an array as its first worth and a consumer ID as its second argument.
Edited so as to add instance
$error = apply_filters('check_for_more_errors', $userid, $error);
add_filter('check_for_more_errors', 'error_check_1', 1, 2);
operate error_check($userid, $error){
$error[] = get_user_meta($userid, 'Plugin 1 consumer error', true);
return $error;
}
add_filter('check_for_more_errors', 'error_check_2', 2, 2);
// $userid beneath is definitely $error returned from error_check_1
operate error_check_2($userid, $error){
$error[] = get_user_meta($userid, 'Plugin 2 consumer error', true);
return $error;
}
The above doesn’t work as I count on or want. The filters appear to daisy chain with one the returning argument of the primary one being handed because the argument to the following one.
I would like each to get the $id variable and for the $error variable to be augmented as within the instance.