php - _load_textdomain_just_in_time

admin2025-05-31  1

Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the anona domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. (This message was added in version 6.7.0.)

_load_textdomain_just_in_time()
wp-includes/l10n.php:1371
get_translations_for_domain()
wp-includes/l10n.php:1409
translate()
wp-includes/l10n.php:195
__()
wp-includes/l10n.php:307
ATP_Theme->atp_themesupport()
wp-content/themes/anona/functions.php:225
ATP_Theme->__construct()
wp-content/themes/anona/functions.php:157

the lines of code it says is


function atp_themesupport()
{
    add_theme_support('post-formats', array(
        'aside',
        'audio',
        'link',
        'image',
        'gallery',
        'quote',
        'status',
        'video',
        'event'
    ));
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'editor-style' );
    add_theme_support( 'title-tag' );

    /**
     * register menu.
     */
    register_nav_menus( array(
        'primary-menu' =>__( 'Primary Menu', 'anona' )
    ));


    /**
     * define content width.
     */
    if (!isset( $content_width ))
        $content_width = 1100;
}

class ATP_Theme
{
    public $theme_name;
    public $meta_box;

    public function __construct()
    {
        $this->atp_constant();
        $this->atp_themesupport();
        $this->atp_head();
        $this->atp_themepanel();
        $this->atp_widgets();
        $this->atp_custom_meta();
        $this->atp_meta_generators();
        $this->atp_common();
    }
if (!function_exists('atp_theme_setup')) {

    add_action('after_setup_theme', 'atp_theme_setup');

    function atp_theme_setup()
    {
        load_theme_textdomain('anona', get_template_directory() . '/languages');
        add_filter('the_content', 'pre_process_shortcode');
        add_filter('widget_text', 'do_shortcode');
        add_filter('posts_where', 'multi_tax_terms');
        add_filter('wp_trim_excerpt', 'new_excerpt_more');
        add_filter('upload_mimes', 'atp_custom_upload_mimes');
        // This theme uses its own gallery styles.
        add_filter( 'use_default_gallery_style', '__return_false' );
    }
}

can you please help me ? thanks a lot

Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the anona domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. (This message was added in version 6.7.0.)

_load_textdomain_just_in_time()
wp-includes/l10n.php:1371
get_translations_for_domain()
wp-includes/l10n.php:1409
translate()
wp-includes/l10n.php:195
__()
wp-includes/l10n.php:307
ATP_Theme->atp_themesupport()
wp-content/themes/anona/functions.php:225
ATP_Theme->__construct()
wp-content/themes/anona/functions.php:157

the lines of code it says is


function atp_themesupport()
{
    add_theme_support('post-formats', array(
        'aside',
        'audio',
        'link',
        'image',
        'gallery',
        'quote',
        'status',
        'video',
        'event'
    ));
    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'automatic-feed-links' );
    add_theme_support( 'editor-style' );
    add_theme_support( 'title-tag' );

    /**
     * register menu.
     */
    register_nav_menus( array(
        'primary-menu' =>__( 'Primary Menu', 'anona' )
    ));


    /**
     * define content width.
     */
    if (!isset( $content_width ))
        $content_width = 1100;
}

class ATP_Theme
{
    public $theme_name;
    public $meta_box;

    public function __construct()
    {
        $this->atp_constant();
        $this->atp_themesupport();
        $this->atp_head();
        $this->atp_themepanel();
        $this->atp_widgets();
        $this->atp_custom_meta();
        $this->atp_meta_generators();
        $this->atp_common();
    }
if (!function_exists('atp_theme_setup')) {

    add_action('after_setup_theme', 'atp_theme_setup');

    function atp_theme_setup()
    {
        load_theme_textdomain('anona', get_template_directory() . '/languages');
        add_filter('the_content', 'pre_process_shortcode');
        add_filter('widget_text', 'do_shortcode');
        add_filter('posts_where', 'multi_tax_terms');
        add_filter('wp_trim_excerpt', 'new_excerpt_more');
        add_filter('upload_mimes', 'atp_custom_upload_mimes');
        // This theme uses its own gallery styles.
        add_filter( 'use_default_gallery_style', '__return_false' );
    }
}

can you please help me ? thanks a lot

Share Improve this question edited Apr 19 at 17:11 mmm 3,8893 gold badges16 silver badges22 bronze badges asked Apr 19 at 14:12 insect trojaninsect trojan 11 silver badge4 bronze badges 2
  • 1 it looks you instantiate ATP_Theme too early. try to do it in the function atp_theme_setup. look the documentation of the function add_theme_support – mmm Commented Apr 19 at 17:15
  • thanks a lot i did the code down and i think it is ok – insect trojan Commented Apr 20 at 5:46
Add a comment  | 

1 Answer 1

Reset to default 0
$shortname = 'atp';

add_action('after_setup_theme', 'atp_theme_setup'); define('PSTCTRL_DIR', get_template_directory() . '/pest-control/');

if (!defined('PESTCONTROL_DIR')) { define('PESTCONTROL_DIR', get_template_directory() . '/pest-control/'); }

// Modified theme initialization add_action('after_setup_theme', function() { global $atp_theme, $url;

if (defined('PESTCONTROL_DIR') && file_exists(PESTCONTROL_DIR . 'index.php')) {
    require_once(PESTCONTROL_DIR . 'index.php');
} else {
    $atp_theme = new ATP_Theme();
    $url = FRAMEWORK_URI . 'admin/images/';
}

}, 5);

if( !function_exists('atp_theme_setup') ){ function atp_theme_setup(){ load_theme_textdomain('anona', get_template_directory() . '/languages'); add_filter('the_content', 'pre_process_shortcode'); add_filter('widget_text', 'do_shortcode'); add_filter('posts_where', 'multi_tax_terms'); add_filter('wp_trim_excerpt', 'new_excerpt_more'); add_filter('upload_mimes', 'atp_custom_upload_mimes'); // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); } }

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748640281a313711.html

最新回复(0)