Skip Navigation

[Resolved] Refresh page after cred_delete_post_link is executed

This thread is resolved. Here is a description of the problem and solution.

Problem:
How can I reload the current page after deleting a post with cred_delete_post_link?

Solution:
https://toolset.com/forums/topic/refresh-page-after-cred_delete_post_link-is-executed/#post-1233391

Relevant Documentation:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_delete_post_link

This support ticket is created 5 years 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 2 voices.

Last updated by Beda 4 years, 12 months ago.

Assisted by: Beda.

Author
Posts
#1233332

I am trying to:

I've used the below code to add a link to a list view that will delete the post listed in the loop, and I'd like the page to refresh after the confirmation message is clicked on. I've tried using the post slug and post id as well as '0' in the redirect element but none of them work to refresh the page. I've also attempted to redirect to other pages for testing purposes, but that does not appear to be working either. Is there something wrong with my syntax? The rest of the functionality is working fine.

<td>[cred_delete_post_link action="delete" text="Delete" message_after="Post deleted" message="Are you sure you want to delete this client?" message_show="1" redirect="590"]</td>

<td>[cred_delete_post_link action="delete" text="Delete" message_after="Post deleted" message="Are you sure you want to delete this client?" message_show="1" redirect="view-clients"]</td>

<td>[cred_delete_post_link action="delete" text="Delete" message_after="Post deleted" message="Are you sure you want to delete this client?" message_show="1" redirect="0"]</td>

Resources I used:

https://toolset.com/documentation/user-guides/cred-shortcodes/

https://toolset.com/forums/topic/cred_delete_post_link-short-code-not-working/

#1233391
Bildschirmfoto 2019-04-20 um 16.10.09.png

You can choose the action after deleting or trashing in the GUI when inserting the cred_delete_post_link

You can Do nothing, Reload the current page or Redirect to another page.
You can also combine this with the Confirmation messages.

When I use it with messages and redirect, then deleting the post will fire a PopUp message "Are you sure you want to delete this post?" (customizable in the "message" attribute).
If I press OK, it will start deleting the post and then another pop up appears with the "Post Deleted" message (customizable in the message_after attribute).
Now, it will redirect to the page I set in redirect attribute (as ID).

The Full Forms ShortCode looks like this after creating it with the GUI:
[cred_delete_post_link action='trash' text='Delete %TITLE%' redirect='2' message_after='Post deleted' message='Are you sure you want to delete this post?' message_show='1' class='cred-refresh-after-delete']

This works locally, hence if there are issues with this on your site, I'd start by inserting the ShortCode using the GUI, if that fails, try without any other Plugin but Toolset, and a native Theme like Twenty Seventeen.
If then this issue is not resolved, please let me see if possible on a local install or online testing site.
Here are details how you can send me a copy of the site if all above fails:
https://toolset.com/faq/provide-supporters-copy-site/

#1233822

Beda,

I was able to resolve the issue with the info you provide, however I had to copy the class in manually as there is no "delete post link" option in the GUI when adding fields to a view. Also, would it be possible to get the documentation updated with an example such as this including the correct class for refreshing as I think it may be of use to others in the future.

Thanks,
Matt

#1234942

There is, it's in the Forms Button, not on the Views and Fields button.

There is no need to include any class anywhere, the steps I provided here are valid as written, I produced that reply on a testing install (compared):
https://toolset.com/forums/topic/refresh-page-after-cred_delete_post_link-is-executed/#post-1233391

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.