# 404-solution/trunk/includes/frontend/FrontendAsyncSuggestionTrigger.php

404 Solution, version trunk. 32 lines.

- Page: https://pluginprobe.com/plugins/404-solution/trunk/code/includes/frontend/FrontendAsyncSuggestionTrigger.php
- Raw: https://pluginprobe.com/plugins/404-solution/trunk/raw/includes/frontend/FrontendAsyncSuggestionTrigger.php
- Modified: 2026-06-23T05:55:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/404-solution/trunk/code/includes/frontend/FrontendAsyncSuggestionTrigger.php#L10-L20`.

```php
<?php

if (!defined('ABSPATH')) {
    exit;
}

/**
 * Starts asynchronous frontend suggestion generation when the 404 page needs it.
 */
class ABJ_404_Solution_FrontendAsyncSuggestionTrigger {

    /** @var ABJ_404_Solution_SpellChecker */
    private $spellChecker;

    /**
     * @param ABJ_404_Solution_SpellChecker $spellChecker
     */
    function __construct($spellChecker) {
        $this->spellChecker = $spellChecker;
    }

    /**
     * @param string $requestedURL
     * @return void
     */
    function triggerIfNeeded(string $requestedURL): void {
        if ($this->spellChecker->does404PageHaveSuggestionsShortcode()) {
            $this->spellChecker->triggerAndCleanupOnFailure($requestedURL);
        }
    }
}

```
