I have a relationship query filter issue. I have a code provided by Toolset Supporter, Shane, to connect the child posts to the parent post automatically due to a 3rd party plugin that generates the child post based on the information from our API. Which works ONLY if I remove the query filter- “Filter by post relationship or repeatable fields group owner” However, removal of that relation query filter doesn’t display only the related child posts of the parent post. It displays all children posts of that type. Is there additional code that you can add on to fix the issue?
Hello. Thank you for contacting the Toolset support.
Can you please share details where you are using the code that connects the posts automatically using the code shared by Shane as well as share what view you are using where you added the post relationship filter and where you are displaying that view.
If I will not able to track this I will pass this ticket to Shane.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I would like to know how you are adding child posts as you will require to connect each child post with the desired parent and I see not child is connected to parent post.
How you are adding/importing child post and how you are connecting them?
the above line of code is added to outside the view's loop and it will not work as it will not have [wpv-post-id] value as you added it outside the view's loop as you can see with your view:
=> hidden link
The addition of child posts is done by a 3rd party plugin that generates new child posts every time the page is visited. It will populate the information in the custom fields. I would like to connect them based on a shared custom field (slug: hazard_id)
If you remove the relationship query filter (Select posts in Any relationship that are related to the Post where this View is shown.) from the view. It will display all the child posts.
Where do you suggest I place the following line of code? I’ve even tried placing it within the Loop item in Test Hazard Products view and that hasn't worked either.
I would like to know what is the parent post and from where it will generate the child post automatically?
I will the whole work flow what page I will require to visit using which it will generate the child post automatically and what will be the parent post in that case?
The parent posts are Test Major Hazards. There are two posts available that can generate the child posts. If you view one of the parent posts. For example: "TC - Bongoyo", it shows that child posts are generated. But because the Test Hazard Products view has the relationship query filter, it doesn't display. You can remove that query filter and refresh either of the parent posts. Then you'll be able to see the issue and child posts.
If you visit the following parent post:
=> hidden link
You will see 9 posts within the post-relationship box "Test Major Hazards Test Hazard Products", but if you click any of those available 9 post, when you click on it, it says "You attempted to edit an item that doesn’t exist. Perhaps it was deleted?".
The thing is that, if you have post relationship created - there must be posts connected within the post relationship, in your case, 9 posts are connected but when we try to access those posts the are not longer accessible, so that is garbage posts may be.
So, I suggest you should remove all garbage related posts (all those 9 posts) from your following parent post:
=> hidden link
If you allow, can I remove those garbase posts and connect few actual posts and test?