Once we have confirmed the reading of WP-CLI, next we will try to register only one new article as a draft.Instead of publishing it all at once, you can register it to a draft state where you can check the content on the management screen, and then stop it without publishing it.
In this article, we will use the Markdown manuscript as the original, and will cover how to check for duplicates, pre-approve registered items, create with draft, record the post ID, and reread after registration. The command examples are for a hypothetical environment. Actually, please use the Limited wrapper prepared by the administrator.
- What changes with draft registration
- Overall flow
- 1. Make the Markdown manuscript the original
- 2. Check the content before registration
- 3. Check if the same slug exists
- 4. Show your registration schedule to others
- 5. Create one draft
- 6. Reread the created post
- 7. Preview on the management screen
- Mechanism to prevent double registration
- Request to AI
- Example of completion report
- Summary
- Reference materials
What changes with draft registration
Unlike read-only confirmations, drafts also save new posts to the WordPress database. Although not typically visible on public pages, it has the following effects:
- Post ID and revision are created
- Displayed in the draft list on the management screen
- Plugins may perform processing when saving.
- Wrong category or poster may be set.
- Personal information and internal information may be saved in the main text
Therefore, it is not “safe to do anything because it is private”.Limit the target to one item and check the registered items first.
Overall flow
Check Markdown manuscript
↓
Check for posts with the same slug and original articles in Trash
↓
Show people the items you plan to register.
↓
Create only one item in draft
↓
Reread post ID, status, and slug
↓
People check the preview of the management screen
↓
Suspended without publication
1. Make the Markdown manuscript the original
If you edit the text only on the WordPress management screen, the manuscript you have and the published content will be out of sync. Prepare a Markdown file for each article and manage at least the following:
---
title: "記事タイトル"
slug: "example-article"
description: "記事内容を簡潔に説明する文章です。"
status: "draft"
---
This front matter is for manuscript management. Rather than mixing it with the WordPress text as is, it is reflected separately in post attributes such as title, slug, description, and status.
The text does not include unconfirmed rates or services, impressions without actual experience, personal information of guests, connection destinations, or internal passes. We will confirm external information with official information before publishing it.
2. Check the content before registration
- Title and body content match
- Slug is based on half-width alphanumeric characters and hyphens
- description correctly summarizes the text
- Headline answers one search intent
- Internal links and reference URLs are correct
- Does not include information that should not be made public
statushas becomedraft- Manuscript file is in an authorized location
If you can’t confirm the categories, tags, and eyecatches yet, we won’t guess them. These are covered in detail in How to safely set categories, tags, and eyecatches.
3. Check if the same slug exists
Before creating a new post, check published, draft, private and other posts separately from original articles in Trash. post_status=any excludes Trash, inherited posts, auto-drafts and custom statuses excluded from search, so the example below explicitly lists the standard WordPress statuses outside Trash. If the site uses custom post statuses, ask the administrator to confirm them and add them to the search.
wp post list \
--post_type=post \
--post_status=publish,future,draft,pending,private,auto-draft,inherit \
--name=example-article \
--fields=ID,post_title,post_name,post_status \
--format=table
wp post list \
--post_type=post \
--post_status=trash \
--fields=ID,post_title,post_name,post_status \
--format=table
Check Trash separately using the list with --post_status=trash. A trashed post may have a slug ending in __trashed, so searching only for its original slug can miss it. Use Trash in the administration screen, the article title and content, and, when necessary, _wp_desired_post_slug checked by the administrator to determine whether it is the same original article. There is no need to restore or delete a trashed article at this stage. If the original article cannot be verified, stop without creating a post.
If an existing post is found, new creation will stop. It is up to people to decide whether to update the existing article or change the slug. If AI automatically adds a number to the end and creates a separate article, it will cause an increase in duplicate pages.
4. Show your registration schedule to others
Report the following before execution.
Registration scheduled
- Type: 1 new post
- Title: Article title
- slug:example-article
- Status: draft
- description: A text that briefly explains the article content.
- Body: Verified Markdown manuscript
- Category/tag/image: Not set this time
- After execution: Reread post ID and status and stop
The registration command will not be executed until someone confirms its contents.
5. Create one draft
WP-CLI official wp post create can read the main text from a file and specify the post status and slug. If you add --porcelain, you will only get the new post ID.
wp post create article-body.md \
--post_type=post \
--post_status=draft \
--post_title="記事タイトル" \
--post_name="example-article" \
--post_excerpt="記事内容を簡潔に説明する文章です。" \
--porcelain
The body file does not include front matter. We will prepare a process to safely extract only the text from the manuscript for management. If you embed the entire text directly in the command string, it is easy to mishandle quotation marks and line breaks, so it is easier to read from a file that is allowed.
On the rapper side, post_type=post, post_status=draft, and 1 are fixed at 1 per item, and free additional arguments are rejected.
6. Reread the created post
Use the post ID returned when creating.
wp post exists 123
wp post get 123 \
--fields=ID,post_title,post_name,post_status,post_excerpt \
--format=json
The items to check are:
- The returned post ID exists
- Title and slug as planned
post_statusbecomesdraft- Excerpt used as description is correct
- Only 1 new post was created
If the status is different, multiple items are created, or the slug is unexpected, it will not be published and will be stopped. Instead of making additional corrections on the spot, report the post ID and current situation to others.
7. Preview on the management screen
You cannot check the actual display just by looking at the WP-CLI output. Open the target draft in your WordPress admin and check the following:
- Markdown, headings, bullet points, code, tables are not broken
- Title and description are appropriate
- Internal and external links have the correct destination
- Front matter is not displayed in the main text
- Poster, category, and tags are as intended
- Do you need eyecatches and alt text?
- Can be read on PC width and smartphone width
- There are no facts or expressions that need to be corrected before publication.
Even after checking the preview, it will not be published during the process of this article. Publishing will be treated as a separate approval that specifies the target post ID.
Mechanism to prevent double registration
If the AI times out midway through, it may appear that registration has failed, but the post may actually be created. Don’t rerun the same command immediately, check with slug. Also check the original articles in Trash as described above.
Safe dedicated processing is done in the following order:
- Check the format of the slug
- Check existing posts with the same slug and original articles in Trash
- If it exists, report the post ID without creating anything.
- Create a draft for only one case where it does not exist
- Reread the new post ID and status
It is important to have a design that prevents drafts from multiplying even if the same request is re-executed.
Request to AI
Please register this Markdown manuscript to WordPress.
This time I'll just create one draft. Please do not publish.
Before execution:
- Indicates title, slug, description, post type, and status
- Search slugs in standard and custom statuses, and check original articles in Trash
- If there is a duplicate or the original article cannot be verified, stop without creating a post.
When registering:
- Post_type is fixed to post and post_status is fixed to draft.
- Use only authorized body files
- Do not guess categories, tags, or images
- Do not change other posts or settings
After registration:
- Reread post ID, title, slug, status, description
- Check that only one new item has been created
- How to preview and report unconfigured items to stop
Please do not reprint confidential information, internal passes, or private text in your answers.
Example of completion report
Draft registration results
- New posts: 1
- Post ID: 123
- Status: draft
- slug:example-article
- Duplicate confirmation: Confirmed before and after registration
- Confirmed: title, description, body
- Not set: Category, tag, eye catch
- Not implemented: Publishing, updating existing articles, and other setting changes
- Next operation: People check the preview on the management screen
Rather than “done,” separate what you have checked and what you have not done.
Summary
The first article registration by AI uses the Markdown manuscript as the original, checks that there are no identical slugs, and creates only one draft. Reread the state with the returned post ID and stop where the person previews.
Please refer to Introduction to WP-CLI without changes for advance confirmation, How to set categories, tags, and eye catches for classification and image settings, and Restricted wrapper for execution restrictions. The process of publishing after someone’s approval is explained in From backup to HTTP/display confirmation.
Reference materials
- WordPress Developer Resources:wp post create
- WordPress Developer Resources:wp post list
- WordPress Developer Resources:wp post exists
- WordPress Developer Resources:wp post get
- WordPress Developer Resources: Trashed post slug changes
Update added on 9 October 2026: The duplicate checks for post statuses and slugs changed in Trash have been clarified according to the official specifications. The original information check date for the article as a whole is 16 August 2026.
Note: Processing when saving a post varies depending on the theme and plugin. Please check in a test environment and always start with one draft in production.

