The
COPYPRESS REST API plugin extends the WordPress REST API with custom endpoints for managing posts, categories, tags, post types, and taxonomies.
Features
- Create, update, and delete posts via REST API.
- Fetch categories, tags, post types, and taxonomies.
- Supports CORS (Cross-Origin Resource Sharing) for making API requests from different origins.
- Allows attaching images to posts via URLs.
Endpoints
/copypress-api/v1/login - Login with username and password to get a JWT token.
- Request Body:
username (string): WordPress username
password (string): WordPress password
POST /copypress-api/v1/posts - Create a new post.
- Request Body:
title (string): The title of the post.
content (string): The content of the post.
excerpt (string, optional): The excerpt of the post.
category_main (string): The category taxonomy name.
category (string): The category name or slug.
tags_main (string, optional): The tags taxonomy name. Required only when tags are provided.
tags (string, optional): Comma-separated list of tag names or slugs.
image (string, optional): URL of an image to be set as the post's featured image.
post_type (string, optional): The post type (default: post).
author_id (int, optional): The ID of the post author (default: current user).
post_status (string): Post publish status.
- Note: Tags are optional. If no tags are provided,
tags_main can be empty and tag processing will be skipped.
- Response: Success message, HTTP status code, and created post object.
PUT /copypress-api/v1/posts/{id} - Update an existing post.
- Request Body: Same as
POST endpoint.
- Response: Success message, HTTP status code, and updated post object.
DELETE /copypress-api/v1/posts/{id} - Delete a post.
- Response: Success message and HTTP status code.
GET /copypress-api/v1/categories - Get all categories.
- Response: Category ID, name, and slug.
GET /copypress-api/v1/tags - Get all tags.
- Response: Tag ID, name, and slug.
GET /copypress-api/v1/post-types - Get all public post types.
- Response: Post type name and label.
GET /copypress-api/v1/get-taxonomies/{post_type} - Get all taxonomies (categories and tags) associated with a specific post type.
- Response: List of categories (hierarchical taxonomies) and tags (non-hierarchical taxonomies).