Skip to content

Commit

Permalink
fix: make sure WP_Rewrite is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
carlalexander committed Dec 14, 2021
1 parent 38c7235 commit 835c357
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Configuration/WordPressConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ public function modify(Container $container)
];
});
$container['rest_url'] = $container->service(function () {
global $wp_rewrite;

if (!$wp_rewrite instanceof \WP_Rewrite) {
$wp_rewrite = new \WP_Rewrite();
$wp_rewrite->init();
}

return get_rest_url();
});
$container['site_icon'] = $container->service(function () {
Expand Down

0 comments on commit 835c357

Please sign in to comment.