Tags, categories, and media
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
Four tools cover the WP taxonomy + media surface:
list_taxonomies— list tags or categories on a sitecreate_taxonomy— create a new tag or categoryupload_media— upload an image from a URL or base64 payload- The
featured_media_idfield oncreate_draft/update_draft
Taxonomies are integer IDs in WP
Section titled “Taxonomies are integer IDs in WP”WordPress REST /wp/v2/posts expects tags and categories as arrays of
integer IDs, not name strings. Two ways:
- Pass IDs directly if you already know them
- Pass name strings — the worker auto-resolves to existing terms or creates
new ones (only
deploy_md_to_sitedoes this auto-create; for directcreate_draftcalls you do it yourself)
Manual workflow
Section titled “Manual workflow”list_taxonomies site_id="<wp-site-id>" type="tags"Returns [{ id: 12, name: "seo", slug: "seo" }, ...].
create_taxonomy site_id="<wp-site-id>" type="categories" name="Marketing"Returns the new term { id: 47, name: "Marketing", slug: "marketing" }.
create_draft site_id="<wp-site-id>" title="Hello" content_html="<p>Body</p>" tags=[12] categories=[47]Upload media + set as featured image
Section titled “Upload media + set as featured image”upload_media site_id="<wp-site-id>" source_url="https://example.com/hero.jpg" filename="hero.jpg" alt="Hero image — pricing page"Returns { id: "1024", source_url: "https://yoursite.com/wp-content/uploads/.../hero.jpg" }.
Then:
update_draft site_id="<wp-site-id>" post_id="142" featured_media_id=1024Hard rules
Section titled “Hard rules”upload_mediais not available on Duda — Duda usesmain_image: { url }directly in the post body viacreate_draft’sfeatured_image_urlfield.- No tool deletes media. To clean up uploaded files, do it in WordPress admin.