Skip to content

Commit

Permalink
Merge pull request #110 from wpstarter/dev
Browse files Browse the repository at this point in the history
Capture new request for handleWp
  • Loading branch information
as247 committed Nov 8, 2023
2 parents 045a003 + 455ad9e commit 11e69f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/WpStarter/Wordpress/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Application extends \WpStarter\Foundation\Application
*
* @var string
*/
const VERSION = '1.9.2';
const VERSION = '1.9.3';

protected $bootstrappedList = [];

Expand Down
8 changes: 7 additions & 1 deletion src/WpStarter/Wordpress/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use WpStarter\Contracts\Foundation\Application;
use WpStarter\Foundation\Http\Kernel as HttpKernel;
use WpStarter\Http\Request;
use WpStarter\Routing\Pipeline;
use WpStarter\Routing\Router;
use WpStarter\Support\Facades\Facade;
use WpStarter\Wordpress\Routing\Router as ShortcodeRouter;

class Kernel extends HttpKernel
Expand Down Expand Up @@ -89,7 +91,7 @@ function registerWpHandler($request)
$hook=(array)$this->wpHandleHook;
add_action($hook[0]??'template_redirect', function ()use($request) {
if($request->isNotFoundHttpExceptionFromRoute()) {
$this->handleWp($request, true);
$this->handleWp(Request::capture(), true);
}
}, $hook[1]??1);
}
Expand Down Expand Up @@ -126,6 +128,10 @@ function handleWp($request, $processResponse=false)
*/
protected function wpSendRequestThroughRouter($request)
{
$this->app->instance('request', $request);

Facade::clearResolvedInstance('request');

return (new Pipeline($this->app))
->send($request)
->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)
Expand Down

0 comments on commit 11e69f9

Please sign in to comment.