admin管理员组文章数量:1323225
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);
本文标签: postsBlock editors annoying warnings
版权声明:本文标题:posts - Block editors annoying warnings 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742073532a2419270.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
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