wp-api-v2-client-java icon indicating copy to clipboard operation
wp-api-v2-client-java copied to clipboard

Improve batch handling of tags

Open johanmynhardt opened this issue 9 years ago • 5 comments

For example, when creating multiple tags on a post, it might be better to create the tags and then set them in a batch instead of updating the post each time a tag is added.

johanmynhardt avatar Feb 04 '16 08:02 johanmynhardt

Hi Johan, When I try to create a post with an existing tag, the tag is not associated with the post in wordpress. In the builder, using the function PostBuilder withCategories(Term[] terms) or PostBuilder withCategories(List<Long> categoryIds) don't affect the end result. Can you confirm to me if it is an issue? Thank you

pborgesalves avatar Aug 06 '17 01:08 pborgesalves

Got it, I can use createPostTag instead. Thank you anyway.

pborgesalves avatar Aug 06 '17 05:08 pborgesalves

Hi @pborgesalves,

Thank you for your feedback. I will have to take a look. There is a test in which a post is created with a particular category, although you are referring to tags but mention category methods. Tags and Categories are not exactly the same (Categories being hierarchical and Tags not.)

I do see that there's no builder method for Tag/s so I will add that and then I can resolve #6 as well!

johanmynhardt avatar Aug 07 '17 07:08 johanmynhardt

Hi @pborgesalves

I have stabilised 4.8.1 that will allow you to use the builder method .withTags(Term... tags) or .withTags(List<Long> tagIds) with existing Tag terms.

It will take a while before available on Maven Central.

johanmynhardt avatar Aug 07 '17 12:08 johanmynhardt

<dependency>
  <groupId>com.afrozaar.wordpress</groupId>
  <artifactId>wp-api-v2-client-java</artifactId>
  <version>4.8.1</version>
</dependency>

johanmynhardt avatar Aug 07 '17 12:08 johanmynhardt