Skip to content

Commit

Permalink
refactor(multisite): add addWordPresHooks method
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaucau committed Dec 18, 2024
1 parent b64076e commit 7337a78
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Orm/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ public function __construct()
);

$this->db = $wpdb;
$this->addWordPresHooks();
}

// Add hook to update prefix when switching between blogs in multisite
protected function addWordPresHooks(): void
{
// Reset Database instance when switching between blogs in multisite to update prefix
add_action('switch_blog', function () {
self::$instance = null;
});
Expand Down

0 comments on commit 7337a78

Please sign in to comment.