# automattic/wp-job-manager architecture

> Architecture diagram of the GitHub repository automattic/wp-job-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/automattic/wp-job-manager
- Repository: https://github.com/automattic/wp-job-manager

## Overview

##### Project Type and Purpose
- This is a WordPress plugin (“WP Job Manager”) that extends WordPress with a lightweight, shortcode-based job-board.
- It registers a custom post type (`job_listing`), renders frontend job listings via templates and shortcodes, provides admin screens, REST/API endpoints, AJAX handlers, and integrates with third-party plugins (SEO, multilingual, WP Import, etc.).

##### File Structure
Top-level directories and their roles:
- assets/        → CSS, JS, images, fonts, and third-party JS/CSS libraries
- includes/      → PHP source organized by feature (abstracts, admin, API, forms, emails, helpers, promoted-jobs, UI, widgets)
- templates/     → PHP template overrides for frontend display and email HTML/plain templates
- docs/          → API docs
- tests/         → PHPUnit and JS test suites
- scripts/       → release scripts, build-plugin, CI helpers
- composer.json, package.json, webpack.config.js → dependency, build, and lint configurations

##### README Insights
- Confirms: shortcode-based, lightweight, plugin for any WP theme
- Points to external docs for API and add-ons

a. Main Components
- WordPress Core
- WP Job Manager Plugin
– Frontend Rendering (shortcodes, templates, asset enqueues)
– Data Layer (custom post type registration, DB reads/writes via WPDB)
– AJAX & REST API Module (class-wp-job-manager-ajax.php, class-wp-job-manager-rest-api.php)
– Email Module (classes under includes/emails + templates/emails)
– Promoted Jobs Add-on Module
– Helpers & Utilities (nonce, caching, geocoding, stats tracking)
- Database (MySQL via WPDB)
- Third-Party Integrations (SEO, WPML, Jetpack, etc. via includes/3rd-party)
- Build & CI Tools (Composer, npm/Webpack, GitHub Actions, Psalm, PHPUnit)

b. Relationships and Interactions
- WordPress Core ↔ Plugin: plugin hooks into init, wp_enqueue_scripts, admin_menu, REST API hooks
- Admin UI ↔ Database: create/update plugin options, CPT settings, taxonomy metadata
- Shortcodes & Templates ↔ Database: query job_listing posts, render HTML
- AJAX & REST API ↔ Frontend JS: job submission, filtering, stats; data serialized to/from JSON
- Email Module ↔ WP_Mail: triggers on post status changes, uses templates to build content
- Promoted Jobs Module ↔ Plugin Core: extends job_listing, schedules status changes, notifications
- Helpers ↔ All Modules: nonce verification, caching, stats collection, geocoding calls
- Build Tools ↔ Source: transpile/bundle JS, compile SCSS to CSS, run static analysis/tests

c. Architectural Patterns & Principles
- Modular plugin structure: split by feature area under includes/
- Hook-based extensibility via WP actions/filters
- Separation of concerns: Admin vs Frontend vs API vs Data
- Template-override model: fallback templates in plugin, overridable in theme
- PSR-4 autoloading (via composer) for PHP classes

d. Key Technologies/Frameworks
- PHP 7+; WordPress Plugin API (actions, filters, shortcodes, REST API)
- JavaScript (ES6) with Webpack, jQuery, third-party libs (chosen, fileupload, select2)
- SCSS for CSS, built via webpack or npm scripts
- PHPUnit for PHP tests, Jest or similar for JS tests
- GitHub Actions for CI, Psalm for static analysis

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "WordPress Core"
        WPCore["WordPress Core"]:::external
    end

    subgraph "WP Job Manager Plugin"
        subgraph "Admin Module"
            AdminUI["Admin UI Module"]:::php
        end
        subgraph "Frontend Rendering"
            Shortcodes["Shortcodes & Templates"]:::frontend
        end
        subgraph "Data Layer"
            DataLayer["CPT & DB Access"]:::php
        end
        subgraph "AJAX & REST API"
            APIAjax["AJAX & REST API"]:::php
        end
        subgraph "Email Module"
            EmailMod["Email Module"]:::php
        end
        subgraph "Promoted Jobs Add-on"
            Promo["Promoted Jobs Add-on"]:::php
        end
        subgraph "Helpers & Utilities"
            Utils["Helpers & Utilities"]:::php
        end
        subgraph "Third-Party Integrations"
            Integrations["3rd-Party Integrations"]:::external
        end
    end

    Database["MySQL Database"]:::db
    Browser["Browser (JS/CSS)"]:::frontend

    subgraph "Development Ecosystem"
        BuildCI["Build & CI Tools"]:::tools
        Tests["Test Suite"]:::tools
    end

    WPCore -->|"hooks"| AdminUI
    WPCore -->|"hooks"| Shortcodes
    WPCore -->|"hooks"| APIAjax
    AdminUI -->|"reads/writes"| DataLayer
    Shortcodes -->|"queries"| DataLayer
    Shortcodes -->|"renders"| Browser
    Browser -->|"AJAX/REST"| APIAjax
    APIAjax -->|"JSON"| Browser
    APIAjax -->|"uses"| DataLayer
    EmailMod -->|"triggers"| WPCore
    Promo -->|"extends"| DataLayer
    Promo -->|"integrates"| AdminUI
    Utils --> AdminUI
    Utils --> Shortcodes
    Utils --> APIAjax
    Utils --> EmailMod
    Integrations -->|"hooks into"| AdminUI
    Integrations -->|"hooks into"| Shortcodes
    Integrations -->|"hooks into"| APIAjax
    AdminUI --> Database
    DataLayer --> Database

    BuildCI -->|"bundles/transpiles"| Browser
    BuildCI -->|"compiles"| assets/css/frontend.scss
    BuildCI -->|"builds"| assets/js/job-submission.js
    Tests -->|"runs on"| AdminUI
    Tests -->|"runs on"| Shortcodes

    classDef php fill:#D0E6FF,stroke:#0B61A4,stroke-width:1px
    classDef frontend fill:#E6F4EA,stroke:#237A30,stroke-width:1px
    classDef db fill:#FFE6CC,stroke:#D35400,stroke-width:1px
    classDef external fill:#F2F2F2,stroke:#7F8C8D,stroke-width:1px
    classDef tools fill:#F9E79F,stroke:#B7950B,stroke-width:1px

    click AdminUI "https://github.com/automattic/wp-job-manager/tree/trunk/includes/admin/"
    click Shortcodes "https://github.com/automattic/wp-job-manager/blob/trunk/includes/class-wp-job-manager-shortcodes.php"
    click Shortcodes "https://github.com/automattic/wp-job-manager/tree/trunk/templates/"
    click DataLayer "https://github.com/automattic/wp-job-manager/blob/trunk/includes/class-wp-job-manager-post-types.php"
    click APIAjax "https://github.com/automattic/wp-job-manager/blob/trunk/includes/class-wp-job-manager-ajax.php"
    click EmailMod "https://github.com/automattic/wp-job-manager/tree/trunk/includes/emails/"
    click Promo "https://github.com/automattic/wp-job-manager/tree/trunk/includes/promoted-jobs/"
    click Utils "https://github.com/automattic/wp-job-manager/tree/trunk/includes/helper/"
    click Integrations "https://github.com/automattic/wp-job-manager/tree/trunk/includes/3rd-party/"
    click BuildCI "https://github.com/automattic/wp-job-manager/tree/trunk/scripts/"
    click BuildCI "https://github.com/automattic/wp-job-manager/blob/trunk/webpack.config.js"
    click BuildCI "https://github.com/automattic/wp-job-manager/blob/trunk/package.json"
    click BuildCI "https://github.com/automattic/wp-job-manager/blob/trunk/composer.json"
    click Tests "https://github.com/automattic/wp-job-manager/tree/trunk/tests/php/"
    click Tests "https://github.com/automattic/wp-job-manager/tree/trunk/assets/js/tests/"
```
