claudeus-wp-mcp
Version:
The most comprehensive WordPress MCP server - 145 production-ready tools for complete WordPress management with AI
123 lines • 3.3 kB
JavaScript
/**
* WordPress Taxonomies API Client
* Handles categories, tags, and custom taxonomies
*/
import { BaseApiClient } from './base-client.js';
export class TaxonomiesApiClient extends BaseApiClient {
// ==========================================
// CATEGORIES
// ==========================================
/**
* Get a list of categories with pagination metadata
*/
async getCategories(filters) {
return this.getPaginated('/categories', filters);
}
/**
* Get a single category by ID
*/
async getCategory(id) {
return this.get(`/categories/${id}`);
}
/**
* Create a new category
*/
async createCategory(data) {
return this.post('/categories', data);
}
/**
* Update an existing category
*/
async updateCategory(id, data) {
return this.put(`/categories/${id}`, data);
}
/**
* Delete a category
*/
async deleteCategory(id, force = false) {
return this.delete(`/categories/${id}?force=${force}`);
}
// ==========================================
// TAGS
// ==========================================
/**
* Get a list of tags with pagination metadata
*/
async getTags(filters) {
return this.getPaginated('/tags', filters);
}
/**
* Get a single tag by ID
*/
async getTag(id) {
return this.get(`/tags/${id}`);
}
/**
* Create a new tag
*/
async createTag(data) {
return this.post('/tags', data);
}
/**
* Update an existing tag
*/
async updateTag(id, data) {
return this.put(`/tags/${id}`, data);
}
/**
* Delete a tag
*/
async deleteTag(id, force = false) {
return this.delete(`/tags/${id}?force=${force}`);
}
// ==========================================
// TAXONOMIES
// ==========================================
/**
* Get all registered taxonomies
*/
async getTaxonomies() {
return this.get('/taxonomies');
}
/**
* Get a specific taxonomy by slug
*/
async getTaxonomy(slug) {
return this.get(`/taxonomies/${slug}`);
}
// ==========================================
// CUSTOM TAXONOMY TERMS
// ==========================================
/**
* Get terms from a custom taxonomy with pagination metadata
* @param taxonomy The taxonomy slug (e.g., 'category', 'post_tag', 'custom_taxonomy')
*/
async getTerms(taxonomy, filters) {
return this.getPaginated(`/${taxonomy}`, filters);
}
/**
* Get a single term from a custom taxonomy
*/
async getTerm(taxonomy, id) {
return this.get(`/${taxonomy}/${id}`);
}
/**
* Create a term in a custom taxonomy
*/
async createTerm(taxonomy, data) {
return this.post(`/${taxonomy}`, data);
}
/**
* Update a term in a custom taxonomy
*/
async updateTerm(taxonomy, id, data) {
return this.put(`/${taxonomy}/${id}`, data);
}
/**
* Delete a term from a custom taxonomy
*/
async deleteTerm(taxonomy, id, force = false) {
return this.delete(`/${taxonomy}/${id}?force=${force}`);
}
}
//# sourceMappingURL=taxonomies.js.map