Skip Navigation

[Résolu] Dynamic redirect for cred_delete_post_link

This support ticket is created Il y a 5 années et 4 mois. 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
- 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)

Marqué : 

This topic contains 1 réponse, has 2 voix.

Last updated by Shane Il y a 5 années et 4 mois.

Assisted by: Shane.

Auteur
Publications
#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: Anglais (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.