bricks_create_post

Phase 4IntermediateComplexity: 6/10
Create a post in any post type with meta, ACF fields, and taxonomy terms

Overview

Create a new WordPress post in any post type (post, page, or custom post type) with full support for meta fields, ACF fields, featured images, and taxonomy term assignments — all in a single API call.

This is the primary tool for populating content in custom post types. After registering a CPT with bricks_register_post_type and setting up ACF fields, use this tool to create the actual content entries that query loops and dynamic data will display.

Key Features

Any Post Type
Create posts in any registered post type — built-in (post, page) or custom (portfolio, team_member, product). Just specify the post_type slug.
Meta & ACF Fields
Set custom meta fields and ACF field values directly during post creation via the meta parameter. No separate API calls needed.
Taxonomy Assignment
Assign taxonomy terms to the post in a single call via the taxonomies parameter. Supports multiple taxonomies simultaneously.
Featured Image
Set the post featured image by providing a media attachment ID from bricks_upload_media.

When to Use

Populating a custom post type with content entries (portfolio items, team members, services)
Creating blog posts or pages programmatically with meta fields and taxonomy terms
Setting up sample/seed data for development and testing
Creating posts with ACF field values and featured images in a single call
Prerequisites
The target post type must be registered (built-in types like "post" and "page" work by default)
For ACF meta fields: ACF plugin must be active with the field group configured for the post type
For featured images: upload the image first with bricks_upload_media to get the attachment ID
For taxonomy terms: the taxonomy must exist and terms must be created (use bricks_create_term)

When NOT to Use

Creating pages with Bricks visual content — use bricks_create_page followed by bricks_add_section instead
Updating existing posts — this tool only creates new posts
You need to create the post type first — use bricks_register_post_type before creating posts in a CPT

Parameters

11 Total Parameters1 Required10 Optional
post_typestringoptional
Post type slug (e.g., "post", "page", "portfolio", "tool"). Defaults to "post".
Default: post
titlestringREQUIRED
Post title displayed in admin and used for slug generation.
contentstringoptional
Post content in HTML format. Used for the main content area of the post.
excerptstringoptional
Post excerpt — a short summary used in archive listings and meta descriptions.
statusstringoptional
Post publication status.
Default: draft Values: draft, publish, pending, private
slugstringoptional
URL slug for the post. Auto-generated from the title if omitted.
parentnumberoptional
Parent post ID for hierarchical post types (e.g., pages).
menu_ordernumberoptional
Menu order for sortable post types. Lower numbers appear first.
featured_imagenumberoptional
Attachment ID for the featured image. Upload the image first with bricks_upload_media.
metaobjectoptional
Key-value pairs for meta fields. Works with ACF fields if ACF is active. Example: { "tool_icon": "fas fa-palette", "tool_url": "https://..." }.
taxonomiesobjectoptional
Taxonomy term assignments as { taxonomy_slug: [term_id, ...] }. Example: { "tool_category": [5, 12] }.

Code Examples


Warning: Undefined array key "example_output" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 12

Create a portfolio item with ACF fields and taxonomy

Create a portfolio CPT entry with custom meta fields, a featured image, and taxonomy term assignment.

JSON
// First upload the featured image
const media = await bricks_upload_media({
  url: "https://example.com/project-hero.jpg",
  filename: "project-webapp.jpg",
  alt_text: "Web application dashboard screenshot"
});

// Then create the post with all data in one call
bricks_create_post({
  post_type: "portfolio",
  title: "SaaS Dashboard Redesign",
  content: "<p>A complete redesign of the analytics dashboard...</p>",
  excerpt: "Modern SaaS dashboard with real-time analytics",
  status: "publish",
  featured_image: media.id,
  meta: {
    "project_url": "https://example.com",
    "client_name": "TechCorp",
    "project_year": "2025",
    "technologies": "React, TypeScript, Tailwind"
  },
  taxonomies: {
    "project_type": [5],
    "skill": [12, 15, 18]
  }
});

Common Mistakes


Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
Custom post types must be registered with bricks_register_post_type before you can create posts in them. Built-in types (post, page) work without registration.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
The taxonomies parameter expects term IDs (numbers), not term names or slugs. Use bricks_list_terms to find the correct IDs, or bricks_create_term to create terms first.

Warning: Undefined array key "fix_description" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 47

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-includes/kses.php on line 2018

Warning: Undefined array key "wrong_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 48

Warning: Undefined array key "right_code" in /var/www/vhosts/mcpbricksbuilder.wecode.swiss/httpdocs/wp-content/themes/bricks/includes/elements/code.php(236) : eval()'d code on line 49
A common agent mistake is registering a CPT and setting up query loops but forgetting to actually create posts in the CPT. The query loop will show nothing without content.

Tips & Warnings

Tips & Warnings

Create content AFTER setting up the CPT and ACF fields. The workflow is: register post type → create ACF field group → create taxonomy terms → create posts with meta and terms.

The meta parameter works with ACF fields when ACF is active. Use the ACF field name (not the field key) as the meta key.

Use status: « publish » for content that should be immediately visible. Use « draft » for content that needs review.

Return Values

FieldTypeDescription
post_idnumberThe ID of the newly created post.
post_typestringThe post type of the created post.
titlestringThe title of the created post.
statusstringThe publication status of the post.
urlstringThe permalink URL of the created post.

Related Tools

Technical Details

Tool ID
bricks_create_post
API Endpoint
/bricks-mcp/v1/posts
HTTP Method
POST
Namespace
content-queries
Source File
wordpress/post-types.ts
Version
1.0
Min Bricks Version
1.9
Requires Auth
Yes

Changelog

v1.0
Initial release with meta, taxonomies, and featured image support
20250101