Skip Navigation

[Resolved] Remove relationship code not working with Intermediary post type and custom fiel

This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by tobiasF-3 4 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1528929

I am using a shortcode to remove a relationship in my frontend which works on all other pages on my website:

[cred-delete-relationship role_items='$fromViews' relationship='project-company' class='smalltext' redirect='self']remove[/cred-delete-relationship]

only on this specific page where I am connecting a project with a company through an Intermediary post type with a custom field that holds the specific type of relationship between company and project (f.ex.: client, agency, etc) the shortcode does nothing.

I have double checked all elements several times and cannot figure out why this is not working?

thx for your help.

#1530167

Hi Tobias,

Thank you for contacting us and I'd be happy to assist.

If the same shortcode is working at other places, it means that it is correct and it's only a matter of current post's scope, where it doesn't work.

For most efficient troubleshooting, it would help if I could get the clone/snapshot of your website, to test this on my own server.
( ref: https://toolset.com/faq/provide-supporters-copy-site/ )

I've set your next reply as private and please include exact details about where this shortcode is working and where it isn't.

regards,
Waqar

#1537461

Hi Tobias,

Thank you for sharing the admin access.

Your observation was correct and in the "Projects" post template, I noticed that the "cred-delete-relationship" shortcode was being used inside the view "PROJECTS - List Clients - View", that loops through the "Projects Companies Intermediary Posts".

Since in this view, the information about the actual participant post types is not available, that shortcode isn't working.

In this case, a better option would be to use "cred_delete_post_link" shortcode to delete the current intermediary post from the loop.
( ref: https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#cred_delete_post_link )

For example:


[cred_delete_post_link action='delete' message_show='0' class='cred-refresh-after-delete']Remove[/cred_delete_post_link]

When an intermediary post is deleted ( not trashed ), it's corresponding relationship is also removed.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1537717

Thx Waqar, works perfectly!!! My issue is resolved now. Thank you!