List posts, pages or another post type, newest first. Returns ID, title, status, excerpt and link for each, without the full content. Filter by post_type, post_status, search text, author (user ID or slug) or a date range. Returns 10 items unless limit is set; page with offset or paged.
输入参数afterlimitpagedauthorbeforeoffsetsearchpost_typeauthor_namepost_statusauthor__not_in
Get one post or page by ID: title, content, status, dates and permalink. Set content_format to "prose" to return the text without block markup.
输入参数ID必填content_format
wp_get_post_snapshot
Get full post details
Get everything about one post by ID: all fields, custom fields, terms, featured image and author. Use include or exclude to limit the sections returned.
输入参数ID必填excludeincludecontent_format
wp_count_posts
Count posts
Count posts by status (published, draft, scheduled, pending, private, trash) for one post type. The default post type is post.
输入参数post_type
wp_get_post_types
List post types
List the public post types on the site with their key and label, such as post, page or product.
无需输入参数。
wp_get_post_meta
Get post custom fields
Get the custom fields of a post by ID. Pass key to read a single field; without it, all custom fields are returned.
输入参数ID必填key
wp_get_taxonomies
List taxonomies
List the taxonomies available for a post type, such as categories and tags.
输入参数post_type
List the terms of a taxonomy (for example every category), optionally filtered by search text or parent term.
输入参数limitparentsearchtaxonomy必填
wp_count_terms
Count terms
Count the terms in a taxonomy.
输入参数taxonomy必填
wp_get_post_terms
Get post terms
List the terms attached to a post, optionally for one taxonomy only.
输入参数ID必填taxonomy
List items in the Media Library with their ID, title and URL. Filter by search text, uploader or date range. Returns 10 unless limit is set.
输入参数afterlimitauthorbeforesearchauthor_name
wp_count_media
Count media
Count the items in the Media Library, optionally within a date range.
输入参数afterbefore
wp_list_block_patterns
List block patterns
List the block patterns available on the site (ready-made layouts from WordPress, the theme and plugins), with name, title, categories and description. Filter by search text or category. Set include_content to true to also get each pattern's block markup, which can be placed in a post with Update post or Edit post text.
输入参数limitsearchcategoryinclude_content
wp_create_post
Create post
Create a post, page or item of another post type. post_title is required. post_content accepts HTML, blocks or Markdown. The status is draft unless post_status says otherwise, and the type is post unless post_type says otherwise. meta_input sets custom fields.
输入参数post_namepost_typemeta_inputpost_title必填post_statuspost_contentpost_excerpt
wp_update_post
Update post
Update an existing post by ID: title, content, excerpt, status, slug, date or custom fields. Pass the fields to change in fields and custom fields in meta_input. Set schedule_for to schedule publication. Passing post_category replaces all of the post's categories.
输入参数ID必填fieldsmeta_inputschedule_for
wp_alter_post
Edit post text
Find and replace text inside one field of a post (for example its content), without sending the whole content again. Supports regular expressions with regex set to true and modifiers in flags.
输入参数ID必填field必填flagsregexsearch必填replace必填
wp_write_blocks
Write blocks
Write block editor content to an existing post from a list of block specs. Types and fields: paragraph (content), heading (content, level 1-6), list (items, ordered), quote (content, citation), image (url, alt, caption), buttons (buttons: text, url), group (blocks), columns (columns: arrays of blocks), separator, spacer (height), code (content), html (content). mode is replace (default), append or prepend.
输入参数ID必填modeblocks必填
wp_delete_post
Move post to trash
Move a post, page or item of another post type to the trash by ID. It can be restored from the trash in WordPress.
输入参数ID必填
wp_set_featured_image
Set featured image
Set the featured image of a post to a Media Library item, or remove it when media_id is empty.
输入参数post_id必填media_id
wp_create_term
Create term
Create a term in a taxonomy, such as a new category or tag, with an optional slug, description and parent.
输入参数slugparenttaxonomy必填term_name必填description
wp_update_term
Update term
Update the name, slug, description or parent of an existing term.
输入参数nameslugparentterm_id必填taxonomy必填description
wp_add_post_terms
Set post terms
Attach terms to a post. With append set to true they are added to the existing terms; otherwise they replace all terms of that taxonomy on the post.
输入参数ID必填terms必填appendtaxonomy
wp_upload_media
Upload media
Add a file to the Media Library, either from a public URL that WordPress downloads or from base64 content with a filename. Optional title, description and alt text.
输入参数alturltitlebase64filenamedescription
wp_update_media
Update media details
Update the title, caption, description or alt text of a Media Library item.
输入参数ID必填alttitlecaptiondescription
wp_create_note
Add editor note
Add an editor note to a block of a post (WordPress 6.9 or later), as shown in the editor's Notes panel. Locate the block with anchor_text (a short exact snippet of its text) or block_index, or reply to an existing note with parent_id.
输入参数content必填post_idparent_idanchor_textblock_index
wp_update_note
Update editor note
Edit the text of an editor note, or mark its thread as resolved or reopen it.
输入参数statuscontentnote_id必填
wp_get_site_info
Get site information
Get the site's name, tagline, address and time zone.
无需输入参数。