BD Auto Blog

Topic Management & Publishing

Updated March 9, 2026 12 min read

The Topic Queue

The topic queue is the heart of BD Auto Blog’s content pipeline. Every article starts as a topic in the queue, stored in the {prefix}_bdab_topics database table. Topics flow through a lifecycle of statuses from creation to publication.

Topic Statuses

Each topic has one of these statuses:

  • Queued — Waiting to be written. The scheduler picks up queued topics in priority order.
  • Writing — Currently being processed by the article writer. This status is set at the start of generation and acts as a lock to prevent double-processing.
  • Published — Successfully converted into a WordPress post. The post_id field links the topic to its post.
  • Skipped — Manually skipped by an administrator. Skipped topics are not picked up by the scheduler.
  • Failed — Article generation failed after 3 retry attempts. The last_error field contains the reason.

Topic Priority

Each topic has a priority from 1 (lowest) to 5 (highest). When the scheduler selects the next topic to write, it picks the queued topic with the highest priority first. If multiple topics share the same priority, the one with the earliest scheduled date (or oldest creation date) is selected. AI-generated topics default to priority 3, but the AI may assign higher priorities (4 or 5) to timely or trending topics.

Topic Fields

Every topic record contains:

  • Title — The proposed blog post title (max 500 characters). Must be unique across the queue (enforced by a database unique index on the first 191 characters).
  • Description — A 1–2 sentence summary of what the article should cover. Used as context in the article writing prompt.
  • Keywords — Comma-separated target SEO keywords (3–5 keywords). Passed to the article writer for SEO optimization.
  • Priority — Integer 1–5 controlling generation order.
  • Scheduled Date — Optional date for scheduling a topic to be written on a specific day.
  • Post ID — Links to the WordPress post after successful generation.
  • Attempts — Number of generation attempts (max 3 before the topic is marked as failed).
  • Last Error — Error message from the most recent failed attempt.

Generating Topics with AI

The primary way to fill your queue is through AI-powered topic generation.

How to Generate Topics

  1. Go to BD Auto Blog → Topics tab.
  2. Click the Generate Topics button.
  3. Choose the number of topics to generate (1 to 20, default: 7).
  4. Wait for the AI to respond. A “Generating topics…” status message appears during processing.
  5. The newly created topics appear in the queue with “Queued” status.

A valid license key is required. If your license is not active, you will see the error: “A valid license key is required. Go to the License tab to activate.”

How the Topic Generator Works

The topic generator sends a structured prompt to the Claude API that includes:

  • Your blog niche, target audience, and preferred tone
  • The current month and year (so topics are timely and reference the correct year)
  • Instructions to focus on high-search-intent formats: informational, how-to, comparison, and listicle topics
  • Your custom instructions (if any)
  • A list of the 50 most recent existing topic titles to avoid duplicates

The AI returns a JSON array of topics, each with a title, description, comma-separated keywords, and priority score. The generator uses a temperature of 0.9 (higher creativity) and a 4096 max token limit.

Deduplication

Before inserting a generated topic, the plugin checks whether a topic with the same title already exists in the database via the topic_title_exists() method. Duplicate titles are silently discarded. The existing titles list is also sent in the prompt to discourage the AI from generating similar titles, though the database check provides the definitive deduplication.

If all generated topics are duplicates of existing ones, you will see the message: “All generated topics already exist in the queue.”

Editing Topics Manually

You can modify any queued topic before it is written:

Editing a Topic

Click the edit icon next to any topic in the queue to modify its fields:

  • Title — Change the proposed article title
  • Description — Update the content direction
  • Keywords — Adjust target SEO keywords
  • Priority — Change the priority (1–5) to control when it gets picked up
  • Status — Change the status (e.g., set a skipped topic back to queued)

Changes are saved immediately via AJAX.

Skipping a Topic

Click the Skip button to mark a topic as skipped. Skipped topics remain in the database but are not selected by the scheduler. You can un-skip a topic by editing it and setting its status back to “queued.” A confirmation dialog (“Skip this topic?”) appears before the action is taken.

Deleting a Topic

Click the Delete button to permanently remove a topic from the queue. This action is irreversible. A confirmation dialog (“Delete this topic?”) appears before the topic is deleted.

Automatic Queue Refill

You do not need to manually generate topics every day. BD Auto Blog includes an automatic queue refill system:

  • Every day at 2:00 AM (site timezone), the scheduler checks the number of queued topics.
  • If the queued count falls below the Queue Minimum Size setting (default: 7), the system automatically generates new topics.
  • The number of topics generated is controlled by the Queue Refill Size setting (default: 7).
  • After refilling (or checking), the next refill is scheduled for the following day at 2:00 AM.

This ensures your queue never runs dry. If the queue is empty and no refill has occurred, the scheduler sends a “Queue Empty” notification email (if enabled in settings).

The Article Generation Flow

When BD Auto Blog writes an article — whether triggered manually via “Write Now” or automatically by the scheduler — it follows a multi-step pipeline:

Step 1: Topic Selection and Locking

  1. The scheduler selects the next queued topic ordered by priority (descending), then by scheduled date (ascending), then by ID (ascending).
  2. The topic status is set to writing and the attempt counter is incremented.
  3. If the topic has already been attempted 3 times, it is marked as failed with the error “Max retry attempts reached.”
  4. A process lock is acquired (10-minute expiry) to prevent overlapping generation. If the lock is held by another process, the scheduler retries in 2 minutes.

Step 2: AI Article Generation

The plugin sends a detailed prompt to the Claude API requesting a JSON response containing:

  • title — SEO-optimized title starting with the primary keyword, including a number and a power word (e.g., “Ultimate,” “Proven,” “Essential”), max 60 characters
  • body — Full HTML article with proper heading hierarchy (H2/H3), pro-tip callout boxes, key takeaways summary, and a Frequently Asked Questions section
  • excerpt — Meta description, max 155 characters
  • categories — Array of 1–3 category names
  • tags — Array of 5–8 tags (first tag is the primary SEO keyword)
  • slug — Short URL slug (3–5 words, max 50 characters, must contain the primary keyword)
  • featured_image_alt — Alt text for the featured image, including the primary keyword
  • faq — Array of question/answer objects matching the FAQ section in the body
  • social (Professional+ only) — Twitter, Facebook, and LinkedIn snippets
  • video_search_query (when YouTube AI mode is enabled) — Optimal YouTube search query

The article writer uses a temperature of 0.6 (focused, consistent) and a max token limit of 8192. The system prompt instructs the AI to write as a senior industry expert, follow E-E-A-T principles, avoid fabricated statistics, use hedging language for uncertain claims, and produce content exclusively for the current year.

Step 3: WordPress Post Creation

The JSON response is parsed, and a WordPress post is created with:

  • The AI-generated title, body, excerpt, and slug
  • Post status set according to the Publish Mode setting (draft or publish)
  • The configured default author
  • The default category plus any AI-suggested categories (new categories are created automatically)
  • Tags from the AI response
  • Any <img> tags hallucinated by the AI are stripped from the body
  • H2 headings receive sanitized id attributes for TOC anchor linking

Step 4: Post-Processing Pipeline

After the post is created, a six-step processing pipeline runs:

  1. Internal Link Resolution[INTERNAL_LINK: topic] placeholders are replaced with real URLs by searching published posts, categories, and tags
  2. Table of Contents — If enabled, a TOC is generated from H2 headings and prepended to the content (minimum 3 headings required)
  3. YouTube Video Embedding — If enabled, a relevant video is found via the YouTube API and embedded at the configured position
  4. CTA Block Insertion — If enabled (Professional+ only), the custom CTA HTML is inserted at the configured position
  5. Featured Image — Generated via branded SVG or fetched from Unsplash, with proper alt text
  6. SEO Meta — Meta description and focus keyword set for Yoast, RankMath, and/or AIOSEO

Finally, Article and FAQ JSON-LD schema markup are stored in post meta and output in the page head for search engine rich results.

Step 5: Logging and Notifications

Every generation attempt is logged in the {prefix}_bdab_article_log table with:

  • Topic ID and Post ID (on success)
  • Status: published or failed
  • Model used
  • Input and output token counts
  • Estimated API cost in USD (calculated at $3/1M input tokens and $15/1M output tokens)
  • Word count of the generated article
  • Generation time in seconds
  • Error message (on failure)

The generated post also receives custom meta fields: _bdab_topic_id, _bdab_log_id, and _bdab_generated (set to true, used to identify AI-generated posts for front-end styling and schema output).

Email notifications are sent based on your settings: publish success, generation errors, or queue empty alerts.

Manual Article Generation (“Write Now”)

You do not have to wait for the scheduler. To generate an article immediately:

  1. Go to BD Auto Blog → Topics.
  2. Find the topic you want to convert into an article.
  3. Click the Write Now button.
  4. A “Writing article…” progress indicator appears while the AI generates the content.
  5. On success, you will see the message “Article created successfully” with a link to edit the post in WordPress.

This triggers the same full pipeline as scheduled generation: AI writing, post creation, post-processing, and logging. It requires an active license.

The Publishing Schedule

BD Auto Blog uses WordPress cron with self-rescheduling single events (the same proven pattern used by the BD Backup plugin). Here is how the daily cycle works:

Daily Generation Cycle

  1. At your configured Publish Time, the bdab_daily_generate cron event fires.
  2. The scheduler checks: Is the plugin paused? Is the license active? If either fails, it reschedules for tomorrow and exits.
  3. It calculates the effective posts per day: min(your_setting, tier_limit).
  4. Instead of generating all articles in one run (which risks hitting PHP’s max_execution_time), it schedules the first article via a bdab_generate_single event with a 10-second delay.
  5. Each single-article event writes one article, then chains the next with a 5-minute delay (or 60-second delay on failure).
  6. This continues until all articles for the day are written or the queue is empty.
  7. The daily generation event reschedules itself for tomorrow at the same time.

Failure Handling

The system is designed to be resilient to failures:

  • API errors — If the Claude API returns an error, the topic is set back to “queued” status (not failed) so it can be retried. The attempt counter is incremented. After 3 failed attempts on the same topic, it is marked as “failed.”
  • Chain continuity — A single article failure does not stop the rest of the day’s generation. The next article in the chain is always scheduled, just with a shorter delay (60 seconds instead of 5 minutes) to make up time.
  • Process locking — A transient-based lock with 10-minute expiry prevents two cron runs from writing articles simultaneously. If the lock is held, the scheduler retries in 2 minutes with the same remaining count.
  • License outages — If the license check fails (e.g., the license server is down), the scheduler still chains the next article attempt, preserving the day’s quota. The last known tier is stored in bdab_last_known_tier to survive temporary API outages.

Queue Refill Schedule

Separate from article generation, the queue refill runs daily at 2:00 AM:

  1. The bdab_refill_queue cron event fires.
  2. It counts the number of topics with “queued” status.
  3. If the count is below the queue_min_size setting (default: 7), it calls BDAB_Topic_Generator::generate_batch() with the queue_refill_size count.
  4. It reschedules itself for tomorrow at 2:00 AM.

Reviewing and Editing Generated Articles

If your Publish Mode is set to “Draft,” each generated article is saved as a draft for your review. Here is the recommended review workflow:

  1. Check the Logs tab for a summary of recently generated articles, including word count and API cost.
  2. Click the Edit link next to any log entry to open the post in the WordPress editor.
  3. Review the article content, headings, and structure. The AI produces well-formatted HTML with H2/H3 hierarchy, but you may want to add personal anecdotes or brand-specific details.
  4. Check the internal links to ensure they point to relevant pages on your site.
  5. Review the featured image. If using branded SVG, verify the title text renders correctly. If using Unsplash, check that the photo is appropriate for the topic.
  6. If your SEO plugin is active, review the auto-populated meta description and focus keyword.
  7. If social snippets are enabled, find the Twitter, Facebook, and LinkedIn snippets in the post’s custom fields for use when promoting the article.
  8. When satisfied, change the post status to “Published” and click Update.

Monitoring with the Activity Log

The Logs tab provides a complete audit trail of every article generation attempt. You can filter logs by status (all, published, failed) and sort by date, cost, or word count.

Each log entry shows:

  • Status — Published (success) or Failed (with error message)
  • Model — The Claude model used (e.g., claude-sonnet-4-6)
  • Tokens — Input and output token counts
  • Cost — Estimated API cost in USD (formatted as $0.0234 for small amounts)
  • Words — Total word count of the generated article
  • Time — How long generation took in seconds
  • Date — When the generation was started and completed

The log totals section shows aggregate statistics: total records, published count, failed count, total input/output tokens, total cost, and total words generated across all time.

The Weekly Digest

Available on Professional and Agency tiers, the weekly digest is an automated email report sent every Monday at 8:00 AM. It includes:

  • Number of articles published in the past 7 days
  • Total words written that week
  • API cost for the week
  • All-time statistics (total articles, total cost, average word count)
  • Current queue status (queued, published, failed counts)
  • Links to every article published that week
  • Current automation status (active or paused) and next scheduled generation time

The digest is delivered to your configured notification email address (or the WordPress admin email if not set). After sending, it automatically reschedules itself for the following Monday.

Front-End Output

BD Auto Blog adds two things to the front end of your site for generated posts (identified by the _bdab_generated post meta):

Schema Markup

On single post pages, the plugin outputs JSON-LD structured data in the <head>:

  • Article schema — Type, headline, description, author, publisher, dates, image, keywords, word count
  • FAQ schema — FAQPage type with all question/answer pairs from the article’s FAQ section

This structured data helps search engines display rich results (FAQ dropdowns, article cards) in search results.

Inline Styles

The plugin outputs a <style> block with CSS for the custom content elements:

  • Table of Contents (.{prefix}-toc) — Light background, indigo left border, clickable anchor links
  • Pro Tip boxes (.{prefix}-tip) — Blue background, blue left border, bold label
  • Key Takeaways (.{prefix}-tk) — Green background, green border, bullet list
  • CTA blocks (.{prefix}-cta) — Clear float, margins
  • YouTube embeds (.{prefix}-yt) — Responsive 16:9 container

When the TOC is enabled, the plugin also hides third-party TOC elements from popular plugins (EasyTOC, LuckyWP TOC, RankMath TOC, Yoast TOC, SimpleTOC) using display:none!important to prevent duplicate tables of contents.

Tips for Best Results

  • Be specific with your niche and audience. “Cloud security for SaaS startups with 10-50 employees” produces far better topics and articles than “technology.”
  • Use Draft mode initially. Review 5–10 articles to calibrate quality before switching to auto-publish.
  • Set custom instructions to enforce brand voice, product mentions, or topic restrictions.
  • Monitor the Logs tab weekly to track API costs and catch any recurring errors.
  • Adjust word count ranges based on your niche. Long-form content (1500–2500 words) tends to rank better for competitive keywords, while shorter posts (800–1200) work well for news-style updates.
  • Keep the queue stocked. Set the queue minimum size to at least 2x your daily post count so you always have a buffer.
  • Edit AI-generated titles if they feel too formulaic. The AI uses power words and numbers as instructed, but a human touch on the title can improve click-through rates.