Skip Navigation

[Resolved] Dynamic redirect for cred_delete_post_link

This support ticket is created 5 years, 4 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Shane 5 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1157643
2018-12-03 22_00_19-Safety Check – Testing Deletion _ Flux.png

I am trying to: dynamically redirect to a page when deleting a post.

I have my delete post link set up like this:

[cred_delete_post_link action="delete" text="Delete" message="Are you sure you want to delete this?" message_show="1" class="cred-refresh-after-delete" redirect="[delete-redirect]"]

I have the following in my functions.php. You'll note i've manually defined the ID for the moment, to rule out an issue with my cookie:

add_shortcode('delete-redirect', function() {
	// $id = $_COOKIE['pageidcookie'];
	$id = '385';
	return $id;
});

However, that all results in the shortcode looking like the attached. How can I sort? Cheers.

#1157902

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

This all looks correct to me.

What could be happening is that the code is expecting a purely numerical value.

What you can do is to define a hook for the redirection, like this.

add_filter("cred_redirect_after_delete_action", "test");
function test($redurl, $post_id) { 
    return "/client/"; 
}

Please let me know if this helps.
Thanks,
Shane

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