Yesterday, looking into error_log file I've found this error:

[15-Oct-2019 08:23:34 UTC] PHP Fatal error: Uncaught Error: Undefined constant 'CRYPTO_AEAD_XCHACHA20POLY1305_IETF_KEYBYTES' in /home/xxxx/public_html/wp-includes/sodium_compat/lib/constants.php:22

Sodium compat cryptographic library has been added into WP since 5.2 version.

But I never seen this error... someone knows something about this issue?

Thanks for any help!


  • Did you find a solution for this?
    – svelandiag
    Commented Sep 1, 2020 at 14:14

2 Answers 2


You need to have the sodium PHP extension installed & enabled if you're running PHP >7.2

  • George if you have a link to a 'How To' guide or some other details you should add them to your answer. Commented Jan 25, 2021 at 15:12

If you have PHP 7.1 (and poss 7.0) you can comment out the related lines from autoload.php, they're not needed.

  • If you're suggesting editing an autoload.php file in the WordPress Core files, don't. See this Q&A thread for a more nuanced explanation than the oft-quoted don't hack core aphorism.
    – Pat J
    Commented Jul 22, 2021 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.