hooks(); } public function hooks() { add_action( 'template_redirect', array( $this, 'redirect_view' ) ); } public function redirect_view() { if (isset($_GET[ALEXR_BOOK_NOW_VIEW])) { $restaurant_id = sanitize_text_field($_GET[ALEXR_BOOK_NOW_VIEW]); $restaurant = \Alexr\Models\Restaurant::find($restaurant_id); if (!$restaurant) { wp_redirect('/'); } ob_start(); include ALEXR_PLUGIN_DIR.'includes/dashboard/templates/book-now/book-now.php'; die(ob_get_clean()); } } } new Alexr_Front_Book_Now();