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.
Parametersafterlimitpagedauthorbeforeoffsetsearchpost_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.
ParametersIDrequiredcontent_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.
ParametersIDrequiredexcludeincludecontent_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.
Parameterspost_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.
Takes no parameters.
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.
ParametersIDrequiredkey
wp_get_taxonomies
List taxonomies
List the taxonomies available for a post type, such as categories and tags.
Parameterspost_type
List the terms of a taxonomy (for example every category), optionally filtered by search text or parent term.
Parameterslimitparentsearchtaxonomyrequired
wp_count_terms
Count terms
Count the terms in a taxonomy.
Parameterstaxonomyrequired
wp_get_post_terms
Get post terms
List the terms attached to a post, optionally for one taxonomy only.
ParametersIDrequiredtaxonomy
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.
Parametersafterlimitauthorbeforesearchauthor_name
wp_count_media
Count media
Count the items in the Media Library, optionally within a date range.
Parametersafterbefore
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.
Parameterslimitsearchcategoryinclude_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.
Parameterspost_namepost_typemeta_inputpost_titlerequiredpost_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.
ParametersIDrequiredfieldsmeta_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.
ParametersIDrequiredfieldrequiredflagsregexsearchrequiredreplacerequired
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.
ParametersIDrequiredmodeblocksrequired
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.
ParametersIDrequired
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.
Parameterspost_idrequiredmedia_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.
Parametersslugparenttaxonomyrequiredterm_namerequireddescription
wp_update_term
Update term
Update the name, slug, description or parent of an existing term.
Parametersnameslugparentterm_idrequiredtaxonomyrequireddescription
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.
ParametersIDrequiredtermsrequiredappendtaxonomy
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.
Parametersalturltitlebase64filenamedescription
wp_update_media
Update media details
Update the title, caption, description or alt text of a Media Library item.
ParametersIDrequiredalttitlecaptiondescription
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.
Parameterscontentrequiredpost_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.
Parametersstatuscontentnote_idrequired
wp_get_site_info
Get site information
Get the site's name, tagline, address and time zone.
Takes no parameters.