When I am trying to edit or add a post/page using block editor, it shows me some weird warnings then they act like they disappear, but when I inspect the page, I see that they are still there. The warnings appear just when I am using my theme.
Note 1: Most of the warnings are eather in the wp-admin
or wp-includes
folder, which I haven't touched at all.
Note 2: I've installed classic editor and it works just fine.
Warnings:
1-
Warning: array_values() expects parameter 1 to be array, null given in E:\Coding\WordPress\blog\app\public\wp-includes\theme.php on line 3995
2-
Warning: array_merge(): Expected parameter 2 to be an array, null given in E:\Coding\WordPress\blog\app\public\wp-includes\theme.php on line 3996
3-
Warning: Cannot modify header information - headers already sent by (output started at E:\Coding\WordPress\blog\app\public\wp-includes\theme.php:3995) in E:\Coding\WordPress\blog\app\public\wp-admin\admin-header.php on line 9
4-
Warning: Cannot modify header information - headers already sent by (output started at E:\Coding\WordPress\blog\app\public\wp-includes\theme.php:3995) in E:\Coding\WordPress\blog\app\public\wp-includes\option.php on line 1050
5-
Warning: Cannot modify header information - headers already sent by (output started at E:\Coding\WordPress\blog\app\public\wp-includes\theme.php:3995) in E:\Coding\WordPress\blog\app\public\wp-includes\option.php on line 1051
When I am trying to edit or add a post/page using block editor, it shows me some weird warnings then they act like they disappear, but when I inspect the page, I see that they are still there. The warnings appear just when I am using my theme.
Note 1: Most of the warnings are eather in the wp-admin
or wp-includes
folder, which I haven't touched at all.
Note 2: I've installed classic editor and it works just fine.
Share Improve this question asked Oct 8, 2020 at 12:41 kuroyzakuroyza 12310 bronze badges 5 |Warnings:
1-
Warning: array_values() expects parameter 1 to be array, null given in E:\Coding\WordPress\blog\app\public\wp-includes\theme.php on line 3995
2-
Warning: array_merge(): Expected parameter 2 to be an array, null given in E:\Coding\WordPress\blog\app\public\wp-includes\theme.php on line 3996
3-
Warning: Cannot modify header information - headers already sent by (output started at E:\Coding\WordPress\blog\app\public\wp-includes\theme.php:3995) in E:\Coding\WordPress\blog\app\public\wp-admin\admin-header.php on line 9
4-
Warning: Cannot modify header information - headers already sent by (output started at E:\Coding\WordPress\blog\app\public\wp-includes\theme.php:3995) in E:\Coding\WordPress\blog\app\public\wp-includes\option.php on line 1050
5-
Warning: Cannot modify header information - headers already sent by (output started at E:\Coding\WordPress\blog\app\public\wp-includes\theme.php:3995) in E:\Coding\WordPress\blog\app\public\wp-includes\option.php on line 1051
1 Answer
Reset to default 2I've made a page where the user can check the supported post formats, and the problem was that in case the user haven't checked any post format it returns false, and instead of returning an array that contains 'standard' like the following return ['standard']
, I used only the keyword return
to stop the function from running.
Here is what I am talking about:
function get_supported_post_formats(){
$options = get_option('post-supports-handler');
if (empty($options)) {
return ['standard'];
}
$formats = [
'standard',
'aside',
'gallery',
'link',
'image',
'quote',
'video',
'status',
'audio',
'chat',
];
$output = [];
foreach ($formats as $format) {
$output[] = (@$options[$format] == '1' ? $format : '');
}
return $output;
}
$output = get_supported_post_formats();
add_theme_support('post-formats', $output);
standard
post format is always shown in the REST API. Does your theme do anything related to post formats? Are you modifying the REST API responses? – Tom J Nowell ♦ Commented Oct 8, 2020 at 13:07