I Built an AI WordPress Plugin That Handles My Entire Blog Workflow

Markdown to Gutenberg blocks. The Content Publisher converts markdown headings, paragraphs, bold, italic, links, and inline code into proper and block comments. The result opens as native blocks in the editor, not a single Classic block blob.

Prompt engineering was most of the work

The excerpt generator went through roughly eight prompt revisions before it stopped producing generic output. A few rules made the difference:

No fluff. The prompt explicitly bans phrases like “unlock potential” or “transform your business,” with bad/good examples included.
Be specific. It demands concrete details — names, technologies, outcomes, actual metrics from the article.
Character limits. A strict 150–155 character target for meta descriptions, with a “describe it to a colleague” tone instruction.
Full content, not a summary. The entire article gets sent rather than a truncated version — that’s what gives the model enough context to pull out the details that actually matter.

The stack

The plugin is vanilla PHP and JavaScript — no build step, no React JSX, no npm dependencies. The Gutenberg panels use wp.element.createElement directly with wp.plugins.registerPlugin and wp.editPost.PluginDocumentSettingPanel. The API client is a single PHP class wrapping wp_remote_post(). The whole plugin is about 1,500 lines across six files.

– Text generation: Gemini 3.5 Flash via the REST API
– Image generation: Gemini 3.1 Flash Image via the same REST API
– Yoast integration: direct update_post_meta() calls to _yoast_wpseo_focuskw, _yoast_wpseo_title, _yoast_wpseo_metadesc
– WordPress APIs: wp_insert_post, wp_set_post_tags, set_post_thumbnail, wp_upload_bits, wp_generate_attachment_metadata

What publishing looks like now

I write the article in a document, paste it into the Content Publisher page, and click “Parse & Create Draft.” The editor opens with content in blocks, Yoast fields filled, tags assigned, excerpt set. I click “Generate Featured Image” in the sidebar, wait about fifteen seconds, and the hero image appears. Review, publish. The metadata side of publishing now takes under a minute instead of fifteen.

The plugin is running in production on bytetect.com right now. If you’re building something similar and want to compare notes on Gemini API edge cases, reach out.

Most of my engineering time goes into building systems for clients, not writing about them. When I do sit down to write, the article itself is the easy part. It’s everything around it that kills the momentum — the excerpt, the Yoast fields, the tags, the featured image, getting the meta description under 155 characters without it reading like marketing copy.

So I built a WordPress plugin that handles all of it. It’s called ByteTect AI Tools, it runs on Google Gemini, and it lives entirely inside the Gutenberg sidebar. Here’s what it does and how I built it.

What the plugin actually does

The plugin adds five AI-powered panels to the WordPress block editor sidebar, each one covering a piece of the publishing workflow I used to do by hand.

AI Excerpt Generator — reads the live article content straight from the editor (not the database, which stays stale until you hit save), sends it to Gemini, and returns a specific, SEO-optimized excerpt. The prompt is built to produce concrete descriptions instead of generic copy — it took more iteration than the PHP did.

AI SEO Optimizer — one click generates all four Yoast fields: focus keyphrase, SEO title (≤60 characters), meta description (140–155 characters), and a suggested slug. The response comes back as structured JSON, gets parsed, and lands in editable fields with live character counts that turn red past the limit. Apply everything at once, or tweak individual fields first.

AI Featured Image Generator — generates a hero image with Gemini’s image model. It saves to the Media Library under a filename built from the focus keyphrase (not image-1.png), with proper alt text, and WordPress handles the size variants automatically.

AI Tag Generator — analyzes the article and suggests five to eight relevant tags. The prompt includes the site’s existing tag list so Gemini reuses tags instead of creating near-duplicates. Tags show up as toggleable pills — deselect what you don’t want, then apply.

AI Content Publisher — a dedicated admin page where I paste a structured draft (SEO metadata in the header, separated by --- from the markdown body). The plugin parses it, converts the markdown to Gutenberg blocks, creates a draft, sets every Yoast field, assigns categories and tags, and drops me into the editor. One paste, one click.

The technical decisions that mattered

Reading live editor content, not the database. The first version of the excerpt generator pulled post_content from get_post() in PHP. Problem: if you haven’t saved, the database is stale. I switched to reading directly from the Gutenberg store with wp.data.select('core/editor').getEditedPostContent() in JavaScript and sending it to the server over AJAX. It’s the only reliable way to get what the editor is actually showing.

Disabling thinking mode. Gemini 3.5 Flash has a thinking mode that splits its response into internal reasoning and output segments. The plugin was returning truncated excerpts because it was only extracting the short output fragment while the real content sat in the thought segment. Setting thinkingConfig.thinkingBudget to 0 forces one clean text response with no internal reasoning attached.

Structured JSON for SEO fields. Instead of four separate calls for keyphrase, title, description, and slug, the SEO optimizer makes one call with a prompt that demands a JSON response. PHP strips any markdown code fences the model adds, runs json_decode, validates the structure, and returns it to the frontend — one round trip, all four fields.

AES-256 encrypted API key storage. The Gemini API key is encrypted at rest with AES-256-CBC, using a key derived from WordPress’s AUTH_KEY salt. It’s never stored in plaintext and never exposed in the admin UI after saving.

Markdown to Gutenberg blocks. The Content Publisher converts markdown headings, paragraphs, bold, italic, links, and inline code into proper and block comments. The result opens as native blocks in the editor, not a single Classic block blob.

Prompt engineering was most of the work

The excerpt generator went through roughly eight prompt revisions before it stopped producing generic output. A few rules made the difference:

No fluff. The prompt explicitly bans phrases like “unlock potential” or “transform your business,” with bad/good examples included.
Be specific. It demands concrete details — names, technologies, outcomes, actual metrics from the article.
Character limits. A strict 150–155 character target for meta descriptions, with a “describe it to a colleague” tone instruction.
Full content, not a summary. The entire article gets sent rather than a truncated version — that’s what gives the model enough context to pull out the details that actually matter.

The stack

The plugin is vanilla PHP and JavaScript — no build step, no React JSX, no npm dependencies. The Gutenberg panels use wp.element.createElement directly with wp.plugins.registerPlugin and wp.editPost.PluginDocumentSettingPanel. The API client is a single PHP class wrapping wp_remote_post(). The whole plugin is about 1,500 lines across six files.

– Text generation: Gemini 3.5 Flash via the REST API
– Image generation: Gemini 3.1 Flash Image via the same REST API
– Yoast integration: direct update_post_meta() calls to _yoast_wpseo_focuskw, _yoast_wpseo_title, _yoast_wpseo_metadesc
– WordPress APIs: wp_insert_post, wp_set_post_tags, set_post_thumbnail, wp_upload_bits, wp_generate_attachment_metadata

What publishing looks like now

I write the article in a document, paste it into the Content Publisher page, and click “Parse & Create Draft.” The editor opens with content in blocks, Yoast fields filled, tags assigned, excerpt set. I click “Generate Featured Image” in the sidebar, wait about fifteen seconds, and the hero image appears. Review, publish. The metadata side of publishing now takes under a minute instead of fifteen.

The plugin is running in production on bytetect.com right now. If you’re building something similar and want to compare notes on Gemini API edge cases, reach out.

Share: LinkedIn

Leave a Comment

Your email address will not be published. Required fields are marked *