Presto Player _load_textdomain_just_in_time

Tech Articles | August 10, 2025 | Blog, Coding, Plugins, Wordpress

This one has been bugging me for months, I use this plugin on a few dozen sites and when I am fault finding it is littered with these notices.

Now nothing is wrong its a change that happened in 6.7.0 but we are not in 6.8.2 and it needs fixing so I spent a few mins this afternoon tracking down this and another annoying bug I can’t replicate and only appears on one site.

Back to Presto Player

This fault is because language translations are called to early in all cases in my own plugins i’ve fixed this by moving the offending article to Init so after using a trace in query monitor I was able to track it to around line 58 in the main plugin file.

Presto player load text domain stack trace

The offending block is below

if ( ! function_exists( 'presto_player_plugin' ) ) {
	function presto_player_plugin() {
		// Check plugin requirements.
		$requirements = new Requirements();
		if ( $requirements->check() ) {
			$container = new Container();
			$factory   = new Factory( $container );
			$container = $container->addRules( $factory->getRules() );  
			$plugin    = $container->create( Controller::class ); //  <---- This is the offending line according to the stack
			$plugin->run();
		}
	}
	presto_player_plugin();
}
PHP

Now we can’t fix this on a line by line basis but as i’ve already fixed this myself multiple times by just moving the call to the init hook

if ( ! function_exists( 'presto_player_plugin' ) ) {
	function presto_player_plugin() {
		$requirements = new Requirements();

		if ( $requirements->check() ) {
			$container = new Container();
			$factory   = new Factory( $container );

			$container = $container->addRules( $factory->getRules() );

			$plugin = $container->create( Controller::class );
			$plugin->run();
		}
	}

	// don't call the function directly as we are moving to init
	add_action( 'init', 'presto_player_plugin', 0 );
}
PHP

So this is exactly what I tried and it worked first time, now I’ve checked my videos and they all seem to work as intended so am not sure if it needs to run that early i.e. plugins loaded but this fixed the errors and my videos still function.

You can see this in action in the video below

Support the Author

buy me a coffee
Really Useful Plugin Logo
Wpvideobank temp
Appoligies for any spelling and grammer issue. As a dyslexic i need to rely on tools for this they like me are not perfect but I do try my best