Tell us what you are trying to do?
I'm trying to offer a front-end way for my users to disconnect an existing M2M relationship.
In the loop item of the View showing the relationship, I have the following shortcode:
<p>[cred-delete-relationship class="btn btn-outline-danger btn-sm" related_item_one="@coaching-engagements.parent" related_item_two="@coaching-engagements.child" role_items='$fromViews' relationship='coaching-engagements' type="button" redirect='self']Disconnect[/cred-delete-relationship]</p>
When I click the Disconnect button, the page reloads but the relationship is still there?
Is there any documentation that you are following?
https://toolset.com/forums/topic/front-end-editing-of-post-relationships/#:~:text=Click%20the%20link%20to%20see,fields%20associated%20with%20this%20relationship.&text=This%20will%20create%20a%20%22Disconnect,front%2Dend%20of%20the%20site.
What is the link to your site?
hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
Do you see any error or warning, on the screen, in the browser's console, or in the server's error log?
( ref: https://wordpress.org/support/article/debugging-in-wordpress/ )
In case there are none, please share temporary admin login details, along with the link to the example page, where this button can be tested.
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Thank you for sharing the access details.
I noticed that the 'cred-delete-relationship' shortcode is being used in the view that is showing the intermediary posts, and not the parent or child posts in the relationship.
In such a case, you'll just need to specify the target parent and child posts, through the 'related_item_one' and 'related_item_two' attributes, without the attribute role_items='$fromViews'.
This means that the current shortcode:
<p>[cred-delete-relationship class="text-danger text-decoration-none" related_item_one="@coaching-engagements.parent" related_item_two="@coaching-engagements.child" role_items='$fromViews' relationship='coaching-engagements' redirect='self']Disconnect[/cred-delete-relationship]</p>
Will need to be changed to:
<p>[cred-delete-relationship class="text-danger text-decoration-none" related_item_one="@coaching-engagements.parent" related_item_two="@coaching-engagements.child" relationship='coaching-engagements' redirect='self']Disconnect[/cred-delete-relationship]</p>
I hope this helps and please let me know if you need further assistance.