I’d like to be able to query a WordPress blog for a list of existing tags so that they can be offered at the time that a new post is being created. Is this possible through AtomPub with WordPress? I’m finding the documentation for WordPress AtomPub support to be lacking. I’m wondering if this is more of a restriction on AtomPub than on the WordPress implementation.
Leave a Reply
You must be logged in to post a comment.
It seems Atom does not have a concept of “tags”, only “categories”. As AtomPub is based on it, it only specifies a request for categories.
The WordPress AtomPub implementation calls
get_categories()
directly, which, of course, defaults to thecategory
taxonomy. However, you can filter the arguments viaget_categories_taxonomy
, and change thetaxonomy
argument to an array that includespost_tag
. You would of course only enable this filter when there is an AtomPub request.When a post is created or updated WordPress only looks at the categories, so you will have to add the non-category terms yourself. You can do this by hooking into the
atompub_create_post
andatompub_put_post
hooks, which get the WordPress post ID and the full entry the client sent, which includes all terms.