SearchCue
Menu

SearchCue WordPress plugin

The SearchCue WordPress plugin makes it easy to add SearchCue to your WordPress site. You can read the source code below, or download the plugin ready to install.

Designed to keep WordPress setup small.

Install the plugin

Download the zip, upload it in WordPress, and activate SearchCue from your plugins screen.

Connect your site

Sign in to SearchCue, copy your site settings, and let the hosted crawler index your public content.

Keep WordPress light

SearchCue runs search and answers from our hosted index instead of adding a heavy search engine to your database.

Source you can inspect.

The browser below is generated from the plugin files during the site build. Pick a file to read it without downloading anything.

Download zip
searchcue SearchCue WordPress plugin source code
README.md 137 lines
# SearchCue - WordPress Plugin

A WordPress plugin that adds [SearchCue](https://searchcue.com) to your site.
Configure your Site ID in the WordPress admin and let SearchCue know when public content changes.

## Features

- Injects the SearchCue embed script into the `<head>` of every public page
- Dedicated **SearchCue** admin menu page to connect and configure your site
- Optional automatic updates when public pages, posts, custom post types, or attachments change
- No external dependencies beyond WordPress core

## Installation

### From ZIP (for production use)

1. Download or build the plugin ZIP (see below)
2. In WordPress admin, go to **Plugins > Add New > Upload Plugin**
3. Upload the ZIP and activate

### Manual

1. Copy the `searchcue` directory into `wp-content/plugins/`
2. Activate via **Plugins** in WordPress admin

## Configuration

1. Open **SearchCue** from the WordPress admin menu
2. Paste your SearchCue Site ID (looks like `site_abc123`)
3. Keep **Automatic updates** checked if you want SearchCue to re-index changed pages automatically
4. Save changes

The embed script will appear in the `<head>` of all public pages that call `wp_head()`.
WordPress can also notify SearchCue when public content or attachments change.

## Development

### Dev Container (recommended)

This project includes a fully containerized development environment:

1. Open this directory in [VS Code](https://code.visualstudio.com/) or any editor that supports Dev Containers
2. When prompted, click **Reopen in Container** (or run **Dev Containers: Reopen in Container** from the command palette)
3. The container will build, install WordPress, symlink the plugin, and activate it
4. Visit `http://localhost:8080` to see the WordPress site
5. Visit `http://localhost:8080/wp-admin/admin.php?page=searchcue` for plugin settings

**Credentials:** `admin` / `admin`

### Local CLI with Docker Compose

If you prefer the terminal over a dev container editor, you can bring up the full WordPress test site with plain Docker Compose commands. You only need [Docker](https://docs.docker.com/get-docker/) installed.

From the `searchcue` plugin directory:

```bash
# Build and start WordPress + MariaDB
docker compose -f .devcontainer/docker-compose.yml up -d --build

# Run the one-time setup (install WordPress, symlink the plugin, activate it)
docker compose -f .devcontainer/docker-compose.yml exec -T plugin bash /workspaces/searchcue/bin/setup.sh
```

Then open your browser:

| What            | URL                                                                   |
| --------------- | --------------------------------------------------------------------- |
| WordPress site  | http://localhost:8080                                                 |
| Admin dashboard | http://localhost:8080/wp-admin                                        |
| Plugin settings | http://localhost:8080/wp-admin/admin.php?page=searchcue |

**Credentials:** `admin` / `admin`

Run the test suite:

```bash
docker compose -f .devcontainer/docker-compose.yml exec plugin php /workspaces/searchcue/tests/run-tests.php
```

Tear everything down when you are done:

```bash
docker compose -f .devcontainer/docker-compose.yml down
```

To also remove the WordPress database and uploaded files (fresh start next time):

```bash
docker compose -f .devcontainer/docker-compose.yml down -v
```

### Running Tests (without Docker)

If you have PHP 7.4+ installed locally:

```bash
php tests/run-tests.php
```

The test suite uses stub WordPress functions so it runs without a full WordPress installation.

### Building a Distribution ZIP

```bash
bin/build-zip.sh
```

This creates `dist/searchcue.zip` containing only the files needed for production deployment (no devcontainer, tests, or build tooling).

## File Structure

```
searchcue/
├── assets/                 WordPress admin menu icon assets
├── .devcontainer/          Dev container configuration for local testing
│   ├── devcontainer.json
│   ├── docker-compose.yml
│   └── Dockerfile
├── bin/
│   ├── setup.sh            WordPress installation and plugin activation
│   └── build-zip.sh        Build a distributable ZIP
├── tests/
│   └── run-tests.php       Standalone test suite with WP function stubs
├── searchcue.php           Main plugin file
├── readme.txt              WordPress plugin compatibility metadata
├── uninstall.php           Cleanup options on plugin uninstall
└── README.md
```

## Uninstalling

When you delete the plugin through WordPress, `uninstall.php` runs automatically and removes all stored options from the database.

## License

This plugin is licensed under the [GNU General Public License v2.0 or later](https://www.gnu.org/licenses/gpl-2.0.html) (GPLv2+), which is the same license as WordPress itself. This is required for plugins published in the [WordPress.org Plugin Directory](https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/#1-plugins-must-be-compatible-with-the-gnu-general-public-license).