Fix Warning: in_array() expects parameter 2 to be array, null given
I have tried to enable the script tag in the posts/pages by using the following approach in one of my Wordpress blog (version 4.9)
steps to reproduce:
- add
define define('CUSTOM_TAGS', true);inwp_config.php - add the following to
functions.phptemplate
function add_scriptfilter( $string ) {
global $allowedtags;
$allowedtags['script'] = array( 'src' => array () );
return $string;
}
add_filter( 'pre_kses', 'add_scriptfilter' );
and it will show this warnings to all pages/posts:
Warning: in_array() expects parameter 2 to be array, null given in wp-includes/kses.php on line 1416
The error is quite straightforward, and therefore I fix it and create a PR, which I hope that can be merged into next release!
The PR is at:
https://github.com/WordPress/WordPress/pull/321
Posted on Utopian.io - Rewarding Open Source Contributors

Thank you for your contribution.
At the moment though, the contribution cannot be accepted yet as your PR has not be accepted/merged into wordpress code.
See the Utopian Rules.
Once that happens, you may edit your post and resubmit for approval.
You can contact us on Discord.
[utopian-moderator]
Thanks.. so if the PR has not been accepted in 7 days but got accepted later, can I repost this?
yes that would definitely work :)