Forum Replies Created
-
AuthorPosts
-
December 15, 2021 at 3:04 AM in reply to: Connected "From/To" relationships obtained via API are backwards (?) #32622
bzx
ParticipantTo answer your last question โ I digged a bit more into the documentation & forum posts, and the solution would be to register another relationship, and create relations (reciprocal to simplify this) in the WP Admin..
Actually, you asked this right in time, since I realised I would need this! ๐ I need to query all relationships between posts, which are from various categories, and I couldn't find any way to filter, as there is no category field returned from the API... unless there is?
Thanks
December 13, 2021 at 10:31 PM in reply to: Connected "From/To" relationships obtained via API are backwards (?) #32575bzx
ParticipantIn my example, my requirement is that both Authors and Books are posts (not the built in WP author role) โ so in order to create a relation between them I am using MB Relationships โ and I am connecting an Author TO the Book. If then I want to have a page showing all Authors and display their Books, I am using the
get_connected()method from the API, but I need to specify thefromkeyword in the query arguments... You're right, it is not unintuitive โ it's illogical ๐December 13, 2021 at 5:17 PM in reply to: Connected "From/To" relationships obtained via API are backwards (?) #32568bzx
ParticipantThanks for your response!
I understand that connections are bi-directional, but the API requires me to explicitly specify the keyword (relationship direction) in the arguments (
fromorto) โ therefore I would expect the query to execute accordingly. Right now it is backwards, don't you think it's quite unintuitive?Simple example: Authors connected TO any Books they wrote. On the page showing Authors if I used
tokeyword in the query, it wouldn't show me any connections... -
AuthorPosts