wp_api.endpoints package
Submodules
wp_api.endpoints.base module
Base class for WordPress REST API endpoints
- class wp_api.endpoints.base.BaseEndpoint(client)[source]
Bases:
objectBase class for WordPress REST API endpoints
- endpoint = None
- __init__(client)[source]
Initialize the endpoint with a client instance
- Parameters:
client – WordPress API client instance
wp_api.endpoints.block_patterns module
Block Patterns endpoint for the WordPress REST API (available in WordPress 5.8+)
- class wp_api.endpoints.block_patterns.BlockPatterns(client)[source]
Bases:
BaseEndpointWordPress Block Patterns API wrapper
- __init__(client)[source]
Initialize the block patterns endpoint with a client instance
- Parameters:
client – WordPress API client instance
wp_api.endpoints.categories module
Categories endpoint for the WordPress REST API
- class wp_api.endpoints.categories.Categories(client)[source]
Bases:
BaseEndpointWordPress Categories API wrapper
- endpoint = 'categories'
- list(context='view', page=1, per_page=10, search=None, exclude=None, include=None, order='asc', orderby='name', hide_empty=False, parent=None, post=None, slug=None, **kwargs)[source]
List categories with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (id, name, slug, etc.)hide_empty (
bool) – Whether to hide categories that don’t have any postsparent (
int) – Limit result set to categories that have a specific parent IDpost (
int) – Limit result set to categories assigned to a specific postslug (
Union[str,List[str]]) – Limit result set to categories with one or more specific slugs
- Return type:
- Returns:
List of categories
wp_api.endpoints.comments module
Comments endpoint for the WordPress REST API
- class wp_api.endpoints.comments.Comments(client)[source]
Bases:
BaseEndpointWordPress Comments API wrapper
- endpoint = 'comments'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, author_email=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date_gmt', parent=None, parent_exclude=None, post=None, status='approve', type='comment', password=None, **kwargs)[source]
List comments with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to comments published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to comments assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes comments assigned to specific authorsauthor_email (
str) – Limit result set to comments with a specific author emailbefore (
str) – Limit response to comments published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, id, include, post, parent, type)parent (
Union[int,List[int]]) – Limit result set to comments with specific parent IDsparent_exclude (
Union[int,List[int]]) – Limit result set to all items except those with specific parent IDspost (
Union[int,List[int]]) – Limit result set to comments assigned to specific postsstatus (
str) – Limit result set to comments with a specific status (approve, hold, spam, trash)type (
str) – Limit result set to comments with a specific type (comment, pingback, trackback)password (
str) – Filter comments by post password, if the post is password protected
- Return type:
- Returns:
List of comments
- create(post, content, author=None, author_name=None, author_email=None, author_url=None, parent=None, status=None, **kwargs)[source]
Create a new comment
- Parameters:
post (
int) – Post ID to which the comment belongscontent (
str) – Content of the commentauthor (
int) – User ID of the comment author (if registered)author_name (
str) – Name of the comment author (if not registered)author_email (
str) – Email of the comment author (if not registered)author_url (
str) – URL/website of the comment author (if not registered)parent (
int) – Parent comment ID (for threaded comments)status (
str) – Comment status (approve, hold, spam, trash)
- Return type:
- Returns:
Created comment data
- update(id, content=None, author=None, author_name=None, author_email=None, author_url=None, post=None, parent=None, status=None, **kwargs)[source]
Update an existing comment
- Parameters:
id (
int) – Comment IDcontent (
str) – Content of the commentauthor (
int) – User ID of the comment author (if registered)author_name (
str) – Name of the comment author (if not registered)author_email (
str) – Email of the comment author (if not registered)author_url (
str) – URL/website of the comment author (if not registered)post (
int) – Post ID to which the comment belongsparent (
int) – Parent comment ID (for threaded comments)status (
str) – Comment status (approve, hold, spam, trash)
- Return type:
- Returns:
Updated comment data
wp_api.endpoints.custom_fields module
Custom fields (post meta) endpoint for the WordPress REST API
- class wp_api.endpoints.custom_fields.CustomFields(client, post_type='posts')[source]
Bases:
BaseEndpointWordPress Custom Fields (post meta) API wrapper
- Parameters:
post_type (str)
- __init__(client, post_type='posts')[source]
Initialize the custom fields endpoint with a client instance and post type
- Parameters:
client – WordPress API client instance
post_type (
str) – Post type (posts, pages, or custom post type)
wp_api.endpoints.custom_post_types module
Custom Post Types support for the WordPress REST API
- class wp_api.endpoints.custom_post_types.CustomPostType(client, post_type)[source]
Bases:
BaseEndpointWordPress Custom Post Type API wrapper
- Parameters:
post_type (str)
- __init__(client, post_type)[source]
Initialize the custom post type endpoint with a client instance
- Parameters:
client – WordPress API client instance
post_type (
str) – Custom post type slug (e.g., ‘product’, ‘portfolio’, etc.)
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date', slug=None, status='publish', **kwargs)[source]
List custom post type items with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to posts published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to posts assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes posts assigned to specific authorsbefore (
str) – Limit response to posts published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)slug (
Union[str,List[str]]) – Limit result set to posts with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to posts with specific statuses
- Return type:
- Returns:
List of custom post type items
- update(id, title=None, content=None, status=None, **kwargs)[source]
Update an existing custom post type item
wp_api.endpoints.media module
Media endpoint for the WordPress REST API
- class wp_api.endpoints.media.Media(client)[source]
Bases:
BaseEndpointWordPress Media API wrapper
- endpoint = 'media'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date', parent=None, parent_exclude=None, slug=None, status='inherit', media_type=None, mime_type=None, **kwargs)[source]
List media items with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to media items published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to media items assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes media items assigned to specific authorsbefore (
str) – Limit response to media items published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)parent (
Union[int,List[int]]) – Limit result set to items with specific parent IDsparent_exclude (
Union[int,List[int]]) – Limit result set to all items except those with specific parent IDsslug (
Union[str,List[str]]) – Limit result set to media items with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to media items with specific statusesmedia_type (
str) – Limit result set to media items with a specific media typemime_type (
str) – Limit result set to media items with a specific MIME type
- Return type:
- Returns:
List of media items
- upload(file_data, file_name=None, title=None, caption=None, description=None, alt_text=None, **kwargs)[source]
Upload a new media file
- Parameters:
- Return type:
- Returns:
Created media item data
wp_api.endpoints.pages module
Pages endpoint for the WordPress REST API
- class wp_api.endpoints.pages.Pages(client)[source]
Bases:
BaseEndpointWordPress Pages API wrapper
- endpoint = 'pages'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, menu_order=None, offset=None, order='desc', orderby='date', parent=None, parent_exclude=None, slug=None, status='publish', **kwargs)[source]
List pages with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to pages published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to pages assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes pages assigned to specific authorsbefore (
str) – Limit response to pages published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsmenu_order (
int) – Limit result set to pages with a specific menu_order valueoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)parent (
Union[int,List[int]]) – Limit result set to items with particular parent IDsparent_exclude (
Union[int,List[int]]) – Limit result set to all items except those with specific parent IDsslug (
Union[str,List[str]]) – Limit result set to pages with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to pages with specific statuses
- Return type:
- Returns:
List of pages
- create(title, content=None, excerpt=None, status='publish', author=None, featured_media=None, comment_status=None, ping_status=None, menu_order=None, parent=None, template=None, **kwargs)[source]
Create a new page
- Parameters:
title (
str) – Page titlecontent (
str) – Page contentexcerpt (
str) – Page excerptstatus (
str) – Page status (publish, future, draft, pending, private)author (
int) – Page author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)menu_order (
int) – The order in which the page should appear in menusparent (
int) – Parent page IDtemplate (
str) – Page template to use
- Return type:
- Returns:
Created page data
- update(id, title=None, content=None, excerpt=None, status=None, author=None, featured_media=None, comment_status=None, ping_status=None, menu_order=None, parent=None, template=None, **kwargs)[source]
Update an existing page
- Parameters:
id (
int) – Page IDtitle (
str) – Page titlecontent (
str) – Page contentexcerpt (
str) – Page excerptstatus (
str) – Page status (publish, future, draft, pending, private)author (
int) – Page author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)menu_order (
int) – The order in which the page should appear in menusparent (
int) – Parent page IDtemplate (
str) – Page template to use
- Return type:
- Returns:
Updated page data
wp_api.endpoints.posts module
Posts endpoint for the WordPress REST API
- class wp_api.endpoints.posts.Posts(client)[source]
Bases:
BaseEndpointWordPress Posts API wrapper
- endpoint = 'posts'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date', slug=None, status='publish', categories=None, categories_exclude=None, tags=None, tags_exclude=None, sticky=None, tax_relation=None, **kwargs)[source]
List posts with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to posts published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to posts assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes posts assigned to specific authorsbefore (
str) – Limit response to posts published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)slug (
Union[str,List[str]]) – Limit result set to posts with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to posts with specific statusescategories (
Union[int,List[int]]) – Limit result set to items with specific categoriescategories_exclude (
Union[int,List[int]]) – Limit result set to items without specified categoriestags (
Union[int,List[int]]) – Limit result set to items with specific tagstags_exclude (
Union[int,List[int]]) – Limit result set to items without specific tagssticky (
bool) – Limit result set to items that are stickytax_relation (
str) – Taxonomy relationship (AND/OR)
- Return type:
- Returns:
List of posts
- create(title, content=None, excerpt=None, status='publish', author=None, featured_media=None, comment_status=None, ping_status=None, format=None, categories=None, tags=None, **kwargs)[source]
Create a new post
- Parameters:
title (
str) – Post titlecontent (
str) – Post contentexcerpt (
str) – Post excerptstatus (
str) – Post status (publish, future, draft, pending, private)author (
int) – Post author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)format (
str) – Post format (standard, aside, chat, gallery, link, image, quote, status, video, audio)
- Return type:
- Returns:
Created post data
- update(id, title=None, content=None, excerpt=None, status=None, author=None, featured_media=None, comment_status=None, ping_status=None, format=None, categories=None, tags=None, **kwargs)[source]
Update an existing post
- Parameters:
id (
int) – Post IDtitle (
str) – Post titlecontent (
str) – Post contentexcerpt (
str) – Post excerptstatus (
str) – Post status (publish, future, draft, pending, private)author (
int) – Post author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)format (
str) – Post format (standard, aside, chat, gallery, link, image, quote, status, video, audio)
- Return type:
- Returns:
Updated post data
wp_api.endpoints.settings module
Settings endpoint for the WordPress REST API
wp_api.endpoints.taxonomies module
Taxonomies endpoint for the WordPress REST API
- class wp_api.endpoints.taxonomies.Taxonomies(client)[source]
Bases:
BaseEndpointWordPress Taxonomies API wrapper
- endpoint = 'taxonomies'
- class wp_api.endpoints.taxonomies.Terms(client, taxonomy)[source]
Bases:
BaseEndpointBase class for taxonomy terms endpoints
- Parameters:
taxonomy (str)
- __init__(client, taxonomy)[source]
Initialize the terms endpoint with a client instance and taxonomy
- Parameters:
client – WordPress API client instance
taxonomy (
str) – Taxonomy slug (e.g., ‘category’, ‘post_tag’)
- list(context='view', page=1, per_page=10, search=None, exclude=None, include=None, order='asc', orderby='name', hide_empty=False, parent=None, post=None, slug=None, **kwargs)[source]
List taxonomy terms with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (id, name, slug, etc.)hide_empty (
bool) – Whether to hide terms that don’t have any postsparent (
int) – Limit result set to terms that have a specific parent IDpost (
int) – Limit result set to terms assigned to a specific postslug (
Union[str,List[str]]) – Limit result set to terms with one or more specific slugs
- Return type:
- Returns:
List of terms
- create(name, slug=None, description=None, parent=None, meta=None, **kwargs)[source]
Create a new term
wp_api.endpoints.users module
Users endpoint for the WordPress REST API
- class wp_api.endpoints.users.Users(client)[source]
Bases:
BaseEndpointWordPress Users API wrapper
- endpoint = 'users'
- list(context='view', page=1, per_page=10, search=None, exclude=None, include=None, offset=None, order='asc', orderby='name', slug=None, roles=None, **kwargs)[source]
List users with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (id, name, registered_date, etc.)slug (
Union[str,List[str]]) – Limit result set to users with one or more specific slugsroles (
Union[str,List[str]]) – Limit result set to users matching at least one specific role
- Return type:
- Returns:
List of users
- create(username, email, password, name=None, first_name=None, last_name=None, description=None, url=None, roles=None, **kwargs)[source]
Create a new user (requires proper authentication with user creation capabilities)
- Parameters:
username (
str) – Username for the useremail (
str) – Email address for the userpassword (
str) – Password for the username (
str) – Display name for the userfirst_name (
str) – First name for the userlast_name (
str) – Last name for the userdescription (
str) – Description/bio for the userurl (
str) – URL/website for the user
- Return type:
- Returns:
Created user data
- update(id, username=None, email=None, password=None, name=None, first_name=None, last_name=None, description=None, url=None, roles=None, **kwargs)[source]
Update an existing user
- Parameters:
id (
int) – User IDusername (
str) – Username for the useremail (
str) – Email address for the userpassword (
str) – Password for the username (
str) – Display name for the userfirst_name (
str) – First name for the userlast_name (
str) – Last name for the userdescription (
str) – Description/bio for the userurl (
str) – URL/website for the user
- Return type:
- Returns:
Updated user data
Module contents
WordPress REST API Endpoints
Collection of endpoint classes for the WordPress REST API
- class wp_api.endpoints.BaseEndpoint(client)[source]
Bases:
objectBase class for WordPress REST API endpoints
- __init__(client)[source]
Initialize the endpoint with a client instance
- Parameters:
client – WordPress API client instance
- endpoint = None
- class wp_api.endpoints.Posts(client)[source]
Bases:
BaseEndpointWordPress Posts API wrapper
- create(title, content=None, excerpt=None, status='publish', author=None, featured_media=None, comment_status=None, ping_status=None, format=None, categories=None, tags=None, **kwargs)[source]
Create a new post
- Parameters:
title (
str) – Post titlecontent (
str) – Post contentexcerpt (
str) – Post excerptstatus (
str) – Post status (publish, future, draft, pending, private)author (
int) – Post author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)format (
str) – Post format (standard, aside, chat, gallery, link, image, quote, status, video, audio)
- Return type:
- Returns:
Created post data
- endpoint = 'posts'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date', slug=None, status='publish', categories=None, categories_exclude=None, tags=None, tags_exclude=None, sticky=None, tax_relation=None, **kwargs)[source]
List posts with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to posts published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to posts assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes posts assigned to specific authorsbefore (
str) – Limit response to posts published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)slug (
Union[str,List[str]]) – Limit result set to posts with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to posts with specific statusescategories (
Union[int,List[int]]) – Limit result set to items with specific categoriescategories_exclude (
Union[int,List[int]]) – Limit result set to items without specified categoriestags (
Union[int,List[int]]) – Limit result set to items with specific tagstags_exclude (
Union[int,List[int]]) – Limit result set to items without specific tagssticky (
bool) – Limit result set to items that are stickytax_relation (
str) – Taxonomy relationship (AND/OR)
- Return type:
- Returns:
List of posts
- update(id, title=None, content=None, excerpt=None, status=None, author=None, featured_media=None, comment_status=None, ping_status=None, format=None, categories=None, tags=None, **kwargs)[source]
Update an existing post
- Parameters:
id (
int) – Post IDtitle (
str) – Post titlecontent (
str) – Post contentexcerpt (
str) – Post excerptstatus (
str) – Post status (publish, future, draft, pending, private)author (
int) – Post author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)format (
str) – Post format (standard, aside, chat, gallery, link, image, quote, status, video, audio)
- Return type:
- Returns:
Updated post data
- class wp_api.endpoints.Pages(client)[source]
Bases:
BaseEndpointWordPress Pages API wrapper
- create(title, content=None, excerpt=None, status='publish', author=None, featured_media=None, comment_status=None, ping_status=None, menu_order=None, parent=None, template=None, **kwargs)[source]
Create a new page
- Parameters:
title (
str) – Page titlecontent (
str) – Page contentexcerpt (
str) – Page excerptstatus (
str) – Page status (publish, future, draft, pending, private)author (
int) – Page author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)menu_order (
int) – The order in which the page should appear in menusparent (
int) – Parent page IDtemplate (
str) – Page template to use
- Return type:
- Returns:
Created page data
- endpoint = 'pages'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, menu_order=None, offset=None, order='desc', orderby='date', parent=None, parent_exclude=None, slug=None, status='publish', **kwargs)[source]
List pages with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to pages published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to pages assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes pages assigned to specific authorsbefore (
str) – Limit response to pages published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsmenu_order (
int) – Limit result set to pages with a specific menu_order valueoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)parent (
Union[int,List[int]]) – Limit result set to items with particular parent IDsparent_exclude (
Union[int,List[int]]) – Limit result set to all items except those with specific parent IDsslug (
Union[str,List[str]]) – Limit result set to pages with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to pages with specific statuses
- Return type:
- Returns:
List of pages
- update(id, title=None, content=None, excerpt=None, status=None, author=None, featured_media=None, comment_status=None, ping_status=None, menu_order=None, parent=None, template=None, **kwargs)[source]
Update an existing page
- Parameters:
id (
int) – Page IDtitle (
str) – Page titlecontent (
str) – Page contentexcerpt (
str) – Page excerptstatus (
str) – Page status (publish, future, draft, pending, private)author (
int) – Page author IDfeatured_media (
int) – Featured image IDcomment_status (
str) – Whether comments are allowed (open, closed)ping_status (
str) – Whether pings are allowed (open, closed)menu_order (
int) – The order in which the page should appear in menusparent (
int) – Parent page IDtemplate (
str) – Page template to use
- Return type:
- Returns:
Updated page data
- class wp_api.endpoints.Users(client)[source]
Bases:
BaseEndpointWordPress Users API wrapper
- create(username, email, password, name=None, first_name=None, last_name=None, description=None, url=None, roles=None, **kwargs)[source]
Create a new user (requires proper authentication with user creation capabilities)
- Parameters:
username (
str) – Username for the useremail (
str) – Email address for the userpassword (
str) – Password for the username (
str) – Display name for the userfirst_name (
str) – First name for the userlast_name (
str) – Last name for the userdescription (
str) – Description/bio for the userurl (
str) – URL/website for the user
- Return type:
- Returns:
Created user data
- endpoint = 'users'
- list(context='view', page=1, per_page=10, search=None, exclude=None, include=None, offset=None, order='asc', orderby='name', slug=None, roles=None, **kwargs)[source]
List users with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (id, name, registered_date, etc.)slug (
Union[str,List[str]]) – Limit result set to users with one or more specific slugsroles (
Union[str,List[str]]) – Limit result set to users matching at least one specific role
- Return type:
- Returns:
List of users
- me(**params)[source]
Get the current user
- Parameters:
**params – Query parameters
- Return type:
- Returns:
Current user data
- update(id, username=None, email=None, password=None, name=None, first_name=None, last_name=None, description=None, url=None, roles=None, **kwargs)[source]
Update an existing user
- Parameters:
id (
int) – User IDusername (
str) – Username for the useremail (
str) – Email address for the userpassword (
str) – Password for the username (
str) – Display name for the userfirst_name (
str) – First name for the userlast_name (
str) – Last name for the userdescription (
str) – Description/bio for the userurl (
str) – URL/website for the user
- Return type:
- Returns:
Updated user data
- class wp_api.endpoints.Media(client)[source]
Bases:
BaseEndpointWordPress Media API wrapper
- endpoint = 'media'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date', parent=None, parent_exclude=None, slug=None, status='inherit', media_type=None, mime_type=None, **kwargs)[source]
List media items with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to media items published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to media items assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes media items assigned to specific authorsbefore (
str) – Limit response to media items published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)parent (
Union[int,List[int]]) – Limit result set to items with specific parent IDsparent_exclude (
Union[int,List[int]]) – Limit result set to all items except those with specific parent IDsslug (
Union[str,List[str]]) – Limit result set to media items with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to media items with specific statusesmedia_type (
str) – Limit result set to media items with a specific media typemime_type (
str) – Limit result set to media items with a specific MIME type
- Return type:
- Returns:
List of media items
- update(id, title=None, caption=None, description=None, alt_text=None, **kwargs)[source]
Update an existing media item
- class wp_api.endpoints.Categories(client)[source]
Bases:
BaseEndpointWordPress Categories API wrapper
- endpoint = 'categories'
- list(context='view', page=1, per_page=10, search=None, exclude=None, include=None, order='asc', orderby='name', hide_empty=False, parent=None, post=None, slug=None, **kwargs)[source]
List categories with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (id, name, slug, etc.)hide_empty (
bool) – Whether to hide categories that don’t have any postsparent (
int) – Limit result set to categories that have a specific parent IDpost (
int) – Limit result set to categories assigned to a specific postslug (
Union[str,List[str]]) – Limit result set to categories with one or more specific slugs
- Return type:
- Returns:
List of categories
- class wp_api.endpoints.Tags(client)[source]
Bases:
BaseEndpointWordPress Tags API wrapper
- endpoint = 'tags'
- list(context='view', page=1, per_page=10, search=None, exclude=None, include=None, order='asc', orderby='name', hide_empty=False, post=None, slug=None, **kwargs)[source]
List tags with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (id, name, slug, etc.)hide_empty (
bool) – Whether to hide tags that don’t have any postspost (
int) – Limit result set to tags assigned to a specific postslug (
Union[str,List[str]]) – Limit result set to tags with one or more specific slugs
- Return type:
- Returns:
List of tags
- class wp_api.endpoints.Comments(client)[source]
Bases:
BaseEndpointWordPress Comments API wrapper
- create(post, content, author=None, author_name=None, author_email=None, author_url=None, parent=None, status=None, **kwargs)[source]
Create a new comment
- Parameters:
post (
int) – Post ID to which the comment belongscontent (
str) – Content of the commentauthor (
int) – User ID of the comment author (if registered)author_name (
str) – Name of the comment author (if not registered)author_email (
str) – Email of the comment author (if not registered)author_url (
str) – URL/website of the comment author (if not registered)parent (
int) – Parent comment ID (for threaded comments)status (
str) – Comment status (approve, hold, spam, trash)
- Return type:
- Returns:
Created comment data
- endpoint = 'comments'
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, author_email=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date_gmt', parent=None, parent_exclude=None, post=None, status='approve', type='comment', password=None, **kwargs)[source]
List comments with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to comments published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to comments assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes comments assigned to specific authorsauthor_email (
str) – Limit result set to comments with a specific author emailbefore (
str) – Limit response to comments published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, id, include, post, parent, type)parent (
Union[int,List[int]]) – Limit result set to comments with specific parent IDsparent_exclude (
Union[int,List[int]]) – Limit result set to all items except those with specific parent IDspost (
Union[int,List[int]]) – Limit result set to comments assigned to specific postsstatus (
str) – Limit result set to comments with a specific status (approve, hold, spam, trash)type (
str) – Limit result set to comments with a specific type (comment, pingback, trackback)password (
str) – Filter comments by post password, if the post is password protected
- Return type:
- Returns:
List of comments
- update(id, content=None, author=None, author_name=None, author_email=None, author_url=None, post=None, parent=None, status=None, **kwargs)[source]
Update an existing comment
- Parameters:
id (
int) – Comment IDcontent (
str) – Content of the commentauthor (
int) – User ID of the comment author (if registered)author_name (
str) – Name of the comment author (if not registered)author_email (
str) – Email of the comment author (if not registered)author_url (
str) – URL/website of the comment author (if not registered)post (
int) – Post ID to which the comment belongsparent (
int) – Parent comment ID (for threaded comments)status (
str) – Comment status (approve, hold, spam, trash)
- Return type:
- Returns:
Updated comment data
- class wp_api.endpoints.Settings(client)[source]
Bases:
BaseEndpointWordPress Settings API wrapper
- endpoint = 'settings'
- class wp_api.endpoints.Taxonomies(client)[source]
Bases:
BaseEndpointWordPress Taxonomies API wrapper
- endpoint = 'taxonomies'
- class wp_api.endpoints.Terms(client, taxonomy)[source]
Bases:
BaseEndpointBase class for taxonomy terms endpoints
- Parameters:
taxonomy (str)
- __init__(client, taxonomy)[source]
Initialize the terms endpoint with a client instance and taxonomy
- Parameters:
client – WordPress API client instance
taxonomy (
str) – Taxonomy slug (e.g., ‘category’, ‘post_tag’)
- create(name, slug=None, description=None, parent=None, meta=None, **kwargs)[source]
Create a new term
- list(context='view', page=1, per_page=10, search=None, exclude=None, include=None, order='asc', orderby='name', hide_empty=False, parent=None, post=None, slug=None, **kwargs)[source]
List taxonomy terms with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (id, name, slug, etc.)hide_empty (
bool) – Whether to hide terms that don’t have any postsparent (
int) – Limit result set to terms that have a specific parent IDpost (
int) – Limit result set to terms assigned to a specific postslug (
Union[str,List[str]]) – Limit result set to terms with one or more specific slugs
- Return type:
- Returns:
List of terms
- class wp_api.endpoints.CustomFields(client, post_type='posts')[source]
Bases:
BaseEndpointWordPress Custom Fields (post meta) API wrapper
- Parameters:
post_type (str)
- __init__(client, post_type='posts')[source]
Initialize the custom fields endpoint with a client instance and post type
- Parameters:
client – WordPress API client instance
post_type (
str) – Post type (posts, pages, or custom post type)
- class wp_api.endpoints.CustomPostType(client, post_type)[source]
Bases:
BaseEndpointWordPress Custom Post Type API wrapper
- Parameters:
post_type (str)
- __init__(client, post_type)[source]
Initialize the custom post type endpoint with a client instance
- Parameters:
client – WordPress API client instance
post_type (
str) – Custom post type slug (e.g., ‘product’, ‘portfolio’, etc.)
- get_meta()[source]
Get a custom fields handler for this custom post type
- Returns:
CustomFields endpoint handler for this custom post type
- list(context='view', page=1, per_page=10, search=None, after=None, author=None, author_exclude=None, before=None, exclude=None, include=None, offset=None, order='desc', orderby='date', slug=None, status='publish', **kwargs)[source]
List custom post type items with various filtering options
- Parameters:
context (
str) – Scope under which the request is made (view, edit, embed)page (
int) – Current page of the collectionper_page (
int) – Maximum number of items to be returned in result setsearch (
str) – Limit results to those matching a stringafter (
str) – Limit response to posts published after a given ISO8601 compliant dateauthor (
Union[int,List[int]]) – Limit result set to posts assigned to specific authorsauthor_exclude (
Union[int,List[int]]) – Ensure result set excludes posts assigned to specific authorsbefore (
str) – Limit response to posts published before a given ISO8601 compliant dateexclude (
Union[int,List[int]]) – Ensure result set excludes specific IDsinclude (
Union[int,List[int]]) – Limit result set to specific IDsoffset (
int) – Offset the result set by a specific number of itemsorder (
str) – Order sort attribute ascending or descending (asc, desc)orderby (
str) – Sort collection by object attribute (date, author, title, etc.)slug (
Union[str,List[str]]) – Limit result set to posts with one or more specific slugsstatus (
Union[str,List[str]]) – Limit result set to posts with specific statuses
- Return type:
- Returns:
List of custom post type items
- class wp_api.endpoints.BlockPatterns(client)[source]
Bases:
BaseEndpointWordPress Block Patterns API wrapper
- __init__(client)[source]
Initialize the block patterns endpoint with a client instance
- Parameters:
client – WordPress API client instance