WordPress / health-check

Health Check is a WordPress plugin that will perform a number of checks on your WordPress install to detect common configuration errors and known issues.
GNU General Public License v2.0
175 stars 56 forks source link

Fixes WordPress 6.7 warning about loading translations too early #479

Open akirk opened 1 week ago

akirk commented 1 week ago

Short introduction

Description of what the PR accomplishes

Admittedly, I cannot see a change in behavior, translations are loaded in the user language even without this PR. Still, I believe it is best practice to load the translations through the hook.

This error message is thrown before the PR:

#0 wp-includes/l10n.php(1386): _load_textdomain_just_in_time('health-check')
#1 wp-includes/l10n.php(194): get_translations_for_domain('health-check')
#2 wp-includes/l10n.php(306): translate('File integrity', 'health-check')
#3 wp-content/plugins/health-check/HealthCheck/Tools/class-health-check-files-integrity.php(20): __('File integrity', 'health-check')
#4 wp-content/plugins/health-check/HealthCheck/Tools/class-health-check-files-integrity.php(297): Health_Check_Files_Integrity->__construct()
#5 wp-content/plugins/health-check/health-check.php(72): require_once('wp-content/plugi...')
#6 wp-includes/class-wp-hook.php(324): HealthCheck\{closure}('')
#7 wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#8 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#9 wp-settings.php(559): do_action('plugins_loaded')
#10 wp-config.php(232): require_once('wp-content/plugi...')
#11 wp-load.php(50): require_once('wp-content/plugi...')
#12 wp-blog-header.php(13): require_once('wp-content/plugi...')
#13 index.php(17): require('wp-content/plugi...')