Array to String Conversion in WordPress General Template on Line 3758

This article explain why this error below occurs while coding for WordPress themes or plugins and how to solve it.

Notice: Array to string conversion in \wp-includes\general-template.php on line 3758

This error occurs while compares two arguments and if identical using function checked, selected and/or disabled but passed the value as an array. The file includes in WordPress version 4.7.3.

To solve this, please make sure the checked, selected or disabled passed parameter at the same type. Compares string to string, array to array, etc.

Example:

$selected = selected( $string_1, $string_2, false );
$selected = selected( $array_1, $array_2, false );

Happy coding!

Create Comment

Your email address will not be published. Required fields are marked *