Note this is mostly a PHP programming question about arrays and is better asked on e.g. Stack Overflow.
As shown in the docs array_push()
acts on the array and takes multiple parameters which get added as array values. It doesn’t add key => value pairs to associative arrays, and it doesn’t return the array itself, so you’re probably looking for array_merge
or just the +
operator, then returning the new value e.g.
add_filter('ft_tabs', function ($tabs) {
$tabs = $tabs + arrary(
'111' => 'aaa',
'222' => 'bbb'
);
return $tabs;
}, 10);
Also it’s poor style to use reserved words like ‘array’ for variables names as you risk confusing the interpreter and getting a very unexpected result such as calling the array
function when you meant to get the value of a variable.