Skip to content

CPT Context Intelligence

WPfaker generates realistic content for standard post types like Posts, Pages, and Products out of the box. But WordPress sites often use niche Custom Post Types — volcanoes, recipes, court rulings, yacht listings — where WPfaker has no built-in knowledge. Without context, every pipeline fails independently: titles become literary nonsense from realText(), taxonomy terms read like Alice in Wonderland excerpts, images show generic stock photos, and comments contain pure filler sentences. CPT Context Intelligence solves this with a single AI call that teaches WPfaker everything it needs to know about any post type.

How It Works

When you generate content for a Custom Post Type, WPfaker asks your configured AI provider a single question: "What is this post type about?" The AI analyzes the CPT slug, label, and registered taxonomies, then returns a structured context object containing domain knowledge, related topics, image search terms, comment tones, content themes, and seed terms for each taxonomy.

This one response feeds all six content pipelines simultaneously — titles, taxonomy terms, featured images, post body content, comments, and custom field detection. The result is cached for 24 hours, so subsequent generation runs reuse the same context instantly without any additional AI calls.

TIP

CPT Context Intelligence requires an AI provider (Google Gemini, Anthropic Claude, or OpenAI GPT) to be configured and enabled. Without AI, WPfaker falls back to its standard generation logic. See AI Settings for setup.

The Context Object

A single AI call produces a comprehensive context object with seven fields. Each field serves one or more generation pipelines:

FieldPurposeUsed by
domainThe subject area (e.g. "geology", "culinary arts")Field detection, title generation
descriptionBrief description of the post type's purposeTitle generation
topicsCore subjects (e.g. "eruptions", "magma", "tectonic plates")Post content, comments, titles
image_keywordsSearch queries for relevant images (e.g. "volcano eruption lava")Featured images
comment_tonesAppropriate comment styles (e.g. "scientific", "educational")Comment generation
content_themesThemes for post body text (e.g. "geological formation", "eruption history")Post content, comments
term_seedsStarter terms per taxonomy (e.g. "Effusive", "Explosive", "Phreatic")Taxonomy generation

What Gets Fixed

Without CPT Context Intelligence, each pipeline fails independently for unknown post types. Here is what changes when context is available.

Titles

Before: The title pipeline falls back to realText(), producing literary excerpts like "Alice was beginning to get very tired" or generic placeholder text.

After: The AI receives domain context, topics, and a description alongside the CPT slug. Title templates reference domain-specific vocabulary — a Volcanoes CPT gets templates like "{volcano_name}: {eruption_type} Eruption in {region}" with realistic placeholder values like "Krakatoa", "Strombolian", and "Pacific Ring of Fire". The prompt explicitly forbids literary text and Lorem ipsum.

Taxonomy Terms

Before: When the Hive has no data for a taxonomy and no AI terms exist, termName() fell back to realText() — producing literary sentence fragments as taxonomy terms.

After: The context object includes term_seeds keyed by taxonomy slug. For a "Volcanoes" CPT with an "Eruption Types" taxonomy, the AI provides seeds like "Effusive", "Explosive", "Phreatic", "Strombolian", and "Plinian". These seeds are injected into the term pool before the generic fallback. Even without AI context, the absolute last resort now generates clean multi-word terms instead of literary excerpts.

INFO

Term seeds discovered through CPT Context are also reported to the Hive learning loop, so future users with the same taxonomy benefit without needing their own AI call.

Featured Images

Before: guessCategoryForPostType() maps known post types to image search categories — "food" for recipes, "house" for real estate — but returns nothing for unknown CPTs. The image provider then downloads a random, unrelated photo.

After: The context object includes image_keywords — targeted search queries like "volcano eruption lava", "volcanic landscape", or "magma crater". When the built-in category map has no match, the first image keyword is used as the search query. A Volcanoes CPT now gets volcanic landscape photography instead of random stock photos.

Post Content

Before: Post body text is generated by postContentVaried(), which produces generic paragraphs with no domain connection. A Volcanoes post reads the same as a Recipes post — random sentences with no topical relevance.

After: When context is available, contextualPostContent() generates HTML content that weaves domain topics and themes into paragraphs, headings, and lists. A Volcanoes post might open with a paragraph about tectonic plate movement, include a heading about eruption classification, and feature a list of monitoring techniques. If no context is available, the system falls back to the standard postContentVaried() output.

Comments

Before: generateCommentContent() produces pure faker sentences with no connection to the post's subject matter. Every comment reads like generic placeholder text regardless of the post type.

After: When context is available, 50 percent of generated comments use domain-aware templates. A comment on a Volcanoes post might read "Great article about tectonic plates!" or "The section on eruption history was really informative." The other 50 percent remain standard faker comments for natural variety. Templates pull from the context's topics and content_themes fields and mix in faker sentences to avoid repetition.

Custom Field Detection

Before: The field detection system uses a CPT domain map to provide context when analyzing field names. Unknown CPTs have no domain, so AI detection for fields like eruption_intensity on a Volcanoes CPT lacks the "geology" context that would help the AI make better decisions.

After: When the built-in domain map has no entry for the current CPT, the domain field from the context object is used as a fallback. The field detector knows that a Volcanoes CPT belongs to the "geology" domain, which helps it make more accurate decisions about ambiguous field names.

Caching

The context object is stored as a WordPress transient with a 24-hour TTL. The cache key includes both the CPT slug and the locale, so generating "Volcanoes" content in English and German produces separate, language-appropriate context objects.

During a generation run, the context is fetched once at the start and shared across all pipelines. There is no per-post overhead — whether you generate 5 posts or 500, the AI is called at most once per CPT per day.

WARNING

Clearing WordPress transients (via WP-CLI, a caching plugin, or the database) will invalidate the cached context. The next generation run will trigger a fresh AI call. This is harmless but adds a few seconds to the first run after a cache clear.

Fallback Behavior

CPT Context Intelligence is designed as an enhancement, not a requirement. Every pipeline has a complete fallback chain:

  1. Built-in patterns — Local, instant, always available
  2. Hive data — Community-sourced patterns (if enabled)
  3. CPT Context — AI-generated domain knowledge (if AI configured)
  4. Generic fallback — Standard faker output

If AI is not configured or the API call fails, all pipelines continue to work using their existing fallback logic. No generation run will fail because of a missing context object.

Supported Post Types

CPT Context Intelligence activates for any post type — built-in or custom. However, it provides the most value for niche or domain-specific CPTs that WPfaker has no built-in knowledge about. Standard post types like post, page, and product already have strong built-in support through pattern matching and hardcoded category maps.

The system is particularly useful for:

  • Domain-specific CPTs — Volcanoes, court rulings, scientific papers, yacht listings
  • Industry verticals — Real estate properties, medical records, event bookings
  • Localized content — CPTs where the label and taxonomies are in a non-English language
  • Complex taxonomies — CPTs with multiple custom taxonomies that need realistic, domain-appropriate terms

Released under the GPL2 License. wpfaker.com