$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>nonce - wp_nonce_url generating invalid links|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

nonce - wp_nonce_url generating invalid links

matteradmin10PV0评论

My goal is to allow users to delete posts they own from the front end. I have an API that returns some JSON along with a link to delete their post.

$delLink = wp_nonce_url( site_url() . "/wp-admin/post.php?action=trash&post=" . $post->ID, 'trash-' . $post->post_type . '_' . $post->ID);

This does return a url with a nonce

.php?post=338&action=trash&_wpnonce=983403d085

If I click this link it brings me to the 'posts' section of my admin panel without deleting the custom post in question.

But if I compare that to the link in my admin panel, the URL should be

.php?post=338&action=trash&_wpnonce=7337993b16

What am I doing wrong here?

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far