Skip to content

Commit

Permalink
Merge pull request #4036 from 10up/fix/delay-load_plugin_textdomain-call
Browse files Browse the repository at this point in the history
Delay load_plugin_textdomain to init and set Domain Path
  • Loading branch information
felipeelia authored Dec 10, 2024
2 parents ee4617e + 5e1a3c8 commit 40e4b0e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions elasticpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: elasticpress
* Domain Path: /lang
*
* This program derives work from Alley Interactive's SearchPress
* and Automattic's VIP search plugin:
Expand Down Expand Up @@ -275,15 +276,23 @@ function handle_upgrades() {
* @since 2.2
*/
function setup_misc() {
load_plugin_textdomain( 'elasticpress', false, basename( __DIR__ ) . '/lang' ); // Load any available translations first.

if ( is_user_logged_in() && ! defined( 'WP_EP_DEBUG' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
define( 'WP_EP_DEBUG', is_plugin_active( 'debug-bar-elasticpress/debug-bar-elasticpress.php' ) );
}
}
add_action( 'plugins_loaded', __NAMESPACE__ . '\setup_misc' );

/**
* Load text domain
*
* @since 5.1.4
*/
function i18n() {
load_plugin_textdomain( 'elasticpress', false, basename( __DIR__ ) . '/lang' );
}
add_action( 'init', __NAMESPACE__ . '\i18n' );

/**
* Set up role(s) with EP capability
*/
Expand Down

0 comments on commit 40e4b0e

Please sign in to comment.