Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file. This project adhere to the [Semantic Versioning](http://semver.org/) standard.

## [0.2.1] 2026-02-03

* Fix - Prevent table readiness checks while WordPress is installing.

## [0.2.0] 2026-01-05

* Version - Update minimum required version of the stellarwp/schema library to v3.2.0.
Expand Down
8 changes: 8 additions & 0 deletions src/Tables/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ public function register(): void {
Register::table( Task_Logs::class );
}

/*
* During WordPress installation, database operations are deferred.
* Don't signal table readiness until installation is complete.
*/
if ( wp_installing() ) {
return;
}

/**
* Fires an action when the Shepherd tables are registered.
*
Expand Down
21 changes: 21 additions & 0 deletions tests/wpunit/Tables/Tables_Provider_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ public function it_should_fire_tables_registered_action_when_successful(): void
$this->assertTrue( $hook_fired, 'The tables_registered action should be fired' );
}

/**
* @test
*/
public function it_should_not_fire_tables_registered_action_when_wp_installing(): void {
// Mock wp_installing() to return true
$this->set_fn_return( 'wp_installing', true );

$hook_fired = false;
$prefix = Config::get_hook_prefix();

add_action( "shepherd_{$prefix}_tables_registered", function() use ( &$hook_fired ) {
$hook_fired = true;
} );

// Re-register to trigger the action
$provider = new Provider( Config::get_container() );
$provider->register();

$this->assertFalse( $hook_fired, 'The tables_registered action should NOT be fired when wp_installing() returns true' );
}

/**
* @test
*/
Expand Down
Loading