admin管理员组

文章数量:1122832

In the reset password page, i have this core inline script in the head section :

<script type='text/javascript'>
/* <![CDATA[ */
var userSettings = {"url":"\/","uid":"0","time":"1713289843","secure":"1"};var _zxcvbnSettings = {"src":"https:\/\/domain.fr\/wp-includes\/js\/zxcvbn.min.js"};/* ]]> */
</script>

but filtering wp_inline_script_attributes like so :

function add_nonce_to_inline_script( $attributes, $javascript ) {
    $nonce = wp_create_nonce( 'my-csp-nonce' );
    $attributes['nonce'] = $nonce;
    return $attributes;
}
add_filter( 'wp_inline_script_attributes', 'add_nonce_to_inline_script', 10, 2 );

Has no effect, while it works with the others inline scripts in that page. I tried to look around wp_print_head_scripts action, but without success.

Do you think it's possible to add a nonce to this inline script ? I can not use 'unsafe-inline' in the CSP header because of the company policy.

本文标签: filterswp reset password pagehead inline script