Custom Integrations

WordPress & PostgreSQL Contractor

Fractional contractor support for businesses working with WordPress and PostgreSQL together.

MIT Technology Review Puck.news Cred.ai MIT TripAdvisor NetBrain

PostgreSQL is an open source relational database that usually sits beside a WordPress site, not under it, holding the analytics events, application data, and reporting tables that WordPress itself (which runs on MySQL or MariaDB) was never designed to store.

Real PostgreSQL Work

I've been building custom WordPress integrations since 2008 — 18+ years connecting WordPress to CRMs, analytics platforms, billing systems, and APIs like PostgreSQL for publishers, SaaS companies, and enterprise teams.

Custom WordPress design and development work by Kevin Leary Custom WordPress design and development work by Kevin Leary Custom WordPress design and development work by Kevin Leary Custom WordPress design and development work by Kevin Leary
Full Portfolio

Support

This is for teams with a PostgreSQL application running beside their WordPress site, or who need WordPress data to reach Postgres.

  • Application databases: Maintain a Postgres database behind an event-collection or tracking application.

  • WordPress to Postgres sync: Build sync jobs that read content or form submissions from the REST API and write them to Postgres.

  • Second database connections: Write a custom plugin that queries a separate Postgres database to show live application data.

  • Architecture planning: Draft architecture questions and plans around a Postgres production data store.

  • Cross-database reporting: Set up reporting that joins WordPress tables with application data.

Experience

My PostgreSQL work has been on the application side of WordPress clients, not inside WordPress. Two clients are covered below.

Cred.ai (a credit optimization bank and card company whose WordPress sites, analytics, and event tracking I have supported for several years). I built and maintain track.cred.ai, their own server-side conversion gateway: a Laravel application that receives events from the marketing site, the onboarding application, and the mobile back end, and delivers them to ad platforms. PostgreSQL is the database behind that application. In mid-2025 I wrote maintenance scripts for that database to clear out the large analytics tables that had accumulated and to identify tables that were no longer in use or needed, so the event store stayed lean. This is the kind of work that follows any event-collection system once it has run for a while: the data is useful, then it is just weight. WordPress was not involved in this task; the connection is that the same company's WordPress sites feed events into the gateway.

Volo Sports (a client I am currently doing privacy-related engineering work for). Their production data lives in PostgreSQL. In November 2026 I drafted a set of architecture questions for their technology lead covering where records for a new workflow should be stored (Firestore versus Postgres), who owns database migrations, which email provider to use, and how to name API routes. The aim was to settle those decisions before building, so the new code fits their existing data platform instead of adding a second, separate store. This was design and scoping work. It was not a database migration or a WordPress task.

That is the whole of it: one maintenance project on a Postgres database and one architecture-planning exercise around it. My PostgreSQL experience is on the application side rather than database administration. What I bring is the ability to place Postgres correctly next to a WordPress site, and to write the code and scripts that join the two.

Approach

PostgreSQL sits beside WordPress in the application stack, not under it. The honest starting point: WordPress core does not run on PostgreSQL. WordPress requires MySQL or MariaDB (the current recommendation is MariaDB 10.11 or newer, or MySQL 8.4 or newer, with PHP 8.3 or newer). So PostgreSQL almost never connects to WordPress directly. It connects around it. The paths that exist:

  • Beside WordPress, in the surrounding application stack. The most common pattern. WordPress runs the marketing site and content, while a separate application (a Laravel service, a mobile back end, a data pipeline) uses PostgreSQL for its own data. WordPress and Postgres never share a connection; they meet through APIs, queues, or scheduled jobs. This is the path I have actually worked on (see below).

  • Content out through the WordPress REST API (or WPGraphQL), data in through your own code. A sync job, ETL script, or webhook handler reads WordPress content or form submissions and writes them to Postgres for reporting, search, or use by another app. This needs custom code or an integration platform, not a plugin.

  • A custom plugin or must-use plugin opening a second database connection. PHP's pgsql or PDO PostgreSQL extensions let WordPress code query a separate Postgres database (for example to show live application data on a page). WordPress's own wpdb object stays on MySQL; the Postgres connection is a separate one you manage, secure, and cache.

  • Reading across databases. PostgreSQL's foreign data wrapper mechanism lets Postgres query external sources, which can include a MySQL/MariaDB database, so reporting can join WordPress tables with application tables without copying them. This suits analytics teams more than site owners.

  • Replacing WordPress's database layer entirely. Possible but not advisable for a business site. The original WordPress.org listing for "PostgreSQL for WordPress" (PG4WP) was closed on November 4, 2022 and is not available for download. A maintained fork (PostgreSQL-For-Wordpress on GitHub, GPL-2.0) works by intercepting WordPress's mysqli_ calls and rewriting the SQL. Its readme requires PHP 8.1 or newer, lists testing against WordPress 6.5.3, and states testing only against PostgreSQL 14.2, which is itself now past end of life. It is a manual install (a db.php drop-in), and plugin compatibility is patchy because many plugins write MySQL-specific SQL. I would not recommend it for production.

Paths I have used: PostgreSQL as the database behind an event-collection application that serves a WordPress-based company (the first client below), and PostgreSQL as the production data store of a client's application that I was designing integrations against (the second). Neither involved running WordPress itself on Postgres.

Benefits

  • WordPress stays fast and simple. Event logs, tracking data, and application records pile up fast. Keeping them in a separate PostgreSQL database stops them from bloating the WordPress database, slowing backups, and complicating staging copies.

  • A proper home for analytics and event data. Postgres handles large tables, indexing, partitioning, and JSONB payloads well, so event data (conversions, ad platform deliveries, form submissions) can be queried and reported on without exporting it first.

  • One source of truth for the product, not just the website. If a company already runs an application on Postgres, tying the WordPress site to it through an API means the site shows the same customer or program data the app does, instead of a copy that drifts.

  • No licence cost and no vendor lock-in. PostgreSQL is free and open source, and runs on any major cloud or your own servers, so the data layer does not add per-event or per-seat billing.

  • Room to clean up and retain data deliberately. Because the data is in a real SQL database, retention rules, pruning scripts, and audit queries are straightforward to write. That matters for privacy requests, where you may need to find and prove what happened to a specific person's data.

  • Mature, long-supported releases. Each major version gets five years of fixes, so the platform you pick will not be forced to change quickly.

Fit

Use it when

  • A WordPress site is one part of a larger system, with a separate application, mobile back end, or event pipeline that needs its own relational database.

  • You are collecting high-volume analytics or conversion events and want to own the data, not rent storage from a tag or analytics vendor.

  • You need to join or report across WordPress content and application data, and need real SQL features (window functions, JSONB, extensions) to do it.

  • Your engineering team already runs Postgres and prefers it for new services.

Do not use it when

  • You want to run WordPress itself on it. Stay on MariaDB or MySQL, which every plugin, host, and WordPress release is built and tested against. The PG4WP fork exists, but the compatibility risk is not worth it for a business site.

  • You only need to store a small amount of site data. WordPress custom post types, custom tables in the existing MySQL database, or ACF fields are simpler and cheaper to maintain.

  • You need document storage with real-time sync to mobile apps. Firestore (or a similar document database) may fit better, and that was one of the questions in my Volo planning: Firestore versus Postgres is a genuine trade-off, not a default.

  • You want a data warehouse for large-scale reporting. BigQuery, Snowflake, or similar warehouses are built for that, with Postgres as the source system feeding them.

Pitfalls I have seen: treating the analytics database as a dump that never gets pruned (tables grow until they slow the application and backups); letting WordPress code query the application database directly without caching or a read-only user; and picking the storage engine before the questions about ownership, migrations, and retention are answered.

Overview

Working with WordPress and PostgreSQL provides a proper home for application and event data when used together well beside the site. PostgreSQL (Postgres) is a free, open source relational database, in development since 1986 at UC Berkeley and now run by a community with no single vendor. It is ACID-compliant, with strong JSON support and extensions such as PostGIS. WordPress core runs on MySQL or MariaDB, so Postgres sits beside it.

FAQ

Answers to the most common questions I see asked by business owners,
CMOs and CTOs about PostgreSQL integrations with WordPress.

Can WordPress run on PostgreSQL?

Not officially. WordPress core targets MySQL and MariaDB, and the official requirements page does not mention PostgreSQL. A maintained community fork of the PG4WP plugin can make it work, but it needs PHP 8.1 or newer, was tested on PostgreSQL 14.2 only, and many plugins will not work with it. For a production business site I recommend MariaDB or MySQL.

Is there an official PostgreSQL plugin for WordPress?

No. The "PostgreSQL for WordPress" listing on WordPress.org was closed on November 4, 2022 and is not available for download. The maintained code lives in a GitHub fork, which you install manually as a database drop-in.

How do I connect WordPress to a PostgreSQL database?

Run Postgres as a separate database and connect through an API or a sync script, or open a second connection from a custom plugin using PHP's PostgreSQL extensions. Either way, WordPress keeps its own database on MySQL or MariaDB. The right approach depends on whether you need to push data out, pull data in, or just report across both.

Why would a WordPress site need PostgreSQL at all?

Usually because the business has an application or data pipeline next to the website. Common examples are event and conversion tracking, customer or account data from a mobile app, and reporting tables. Those belong in a purpose-built database, not in the WordPress tables.

Should I migrate my WordPress database from MySQL to PostgreSQL?

Almost always no. Plugins and themes write MySQL-flavored SQL, hosts support MySQL and MariaDB, and the performance and support gains are small compared to the risk. If you want Postgres features for analytics, add Postgres next to WordPress instead.

Which version of PostgreSQL should I use?

Run a currently supported major version. As of this research, versions 15 through 18 are supported, and version 14 reaches end of life on November 12, 2026. Apply the current minor release of whichever major version you use, since those carry the bug and security fixes. Major upgrades require a dump and reload or pg_upgrade, so plan them.

Is PostgreSQL free?

The software is free and open source. Costs come from hosting it: either a managed service from a cloud provider or the servers and administration time to run it yourself. Pricing varies widely by provider and size.

Can you help with the data side of a WordPress project?

Yes, within the limits described above: connecting a site to an application's data through APIs, writing maintenance and retention scripts, and helping decide where new data should live before it gets built. I am a WordPress and analytics engineer, not a full-time database administrator, so large Postgres tuning or hosting projects are better paired with a DBA.

Scott Maxwell, Founder and Managing Partner at Openview Venture Partners
Kevin's ability as a web developer and consultant, along with his eagerness to add value, have been a tremendously valuable asset to our firm and investment companies. His in-depth knowledge of B2B technologies, and straight forward ideas and advice, have been a very strong asset for us.
Scott Maxwell Founder and Managing Partner
OpenView Venture Partners

Need help integrating PostgreSQL and WordPress?

If you're integrating your WordPress website with PostgreSQL I can help. Schedule a free consultation on Google Meet, or contact me by email directly.

By Email or

Additional Consulting Services

Custom integrations are one slice of a broader practice. I've spent 18+ years as a fractional engineer for marketing and product teams — designing, building, securing, and measuring WordPress platforms end to end.