Returning unrelated posts when connected to a draft post.
-
get_related() (or get_connected() ) is returning unrelated posts when the related post is a draft.
Example:
I have the post “A1” , which is connected to the post “B4”, where the letter refers to the post type and the number to the post ID.
If post “B4” is published, get_related() on “A1” will return ‘A’ posts that are linked to post “B4”. Great.
The problem is, as I set post “B4” status to ‘draft’, get_related() on “A1” will return a lot of “A” posts unrelated to “B4”.
Why? I expect it to return anything. Maybe that’s a default implementation that will return some random posts case there are no related posts? It is returning always the same ten posts (out of a lot more) though.
Hope that’s clear. Thanks in advance.
- The topic ‘Returning unrelated posts when connected to a draft post.’ is closed to new replies.