Skip Navigation

[Gelöst] Dynamic redirect for cred_delete_post_link

This support ticket is created vor 5 Jahren, 12 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 1 Antwort, hat 2 Stimmen.

Zuletzt aktualisiert von Shane vor 5 Jahren, 12 Monaten.

Assistiert von: Shane.

Author
Artikel
#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

Sprachen: Englisch (English )

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