I have an error with array_merge [closed]

-1

It's not really an error, it's a warning I'd like to eliminate.

I pass the code and the error to see if anyone knows how to solve it.

function brc_hidden_meta_boxes( $hidden ) {
    $hidden = array_merge( $hidden, array( 'slugdiv' ) );

    return $hidden;
}
    
asked by Santiago D'Antuoni 28.10.2016 в 19:24
source

1 answer

1

You are doing array_merge() when in fact your intention is to add one more data to your arrangement, while array_merge() combines two fixes.

PHP: array_merge

  

Combine the elements of one or more arrays by joining them so that the values of one are appended to the end of the previous one. Returns the resulting array.

Paying attention to the documentation array_merge() combines the (plural) values of one or more arrays ... If the OP wants to add a single data in specific because it occupies something that in that case it does not is it necessary?

For your case it should be:

function brc_hidden_meta_boxes( $hidden ) {
    $hidden[] = 'slugdiv';

    return $hidden;
}
    
answered by 28.10.2016 / 19:33
source