Sauter la navigation

[Résolu] Dynamic redirect for cred_delete_post_link

This support ticket is created Il y a 6 années et 1 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.

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é : 

Ce sujet contient 1 réponse, a 2 voix.

Dernière mise à jour par Shane Il y a 6 années et 1 mois.

Assisté par: 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

Les langues: Anglais (English )

Fuseau horaire: 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