Just use get_delete_post_link( $post_ID ) – it’ll return the absolute URL with nonce and all!
Just to be clear, this will get the link to trash posts (if trash supported). If you want to skip trash & get the perma-delete link, pass a second argument of *.true
http://codex.wordpress.org/Function_Reference/get_delete_post_link
Update: Having checked the source, it seems the codex is a little out of date. The second argument is deprecated, so pass an empty string & the third arg as true:
get_delete_post_link( $post_ID, '', true );
Related Posts:
- Nonce for Trashing Item
- How does nonce verification work?
- How to expire a nonce?
- Fatal error: Call to undefined function wp_create_nonce()
- Using nonce external of WP Admin
- Nonce best practices: hidden input vs. wp_localize_script?
- “The link you followed has expired” when previewing a post
- wp_verify_nonce keeps failing
- Handling nonce generation in AJAX registration process
- increase nonce lifespan
- wp_verify_nonce() via REST always returns false
- Nonce failing in IE
- my theme breaks WP export
- Why am I getting a 403 from check_admin_referer()?
- x-wp-nonce across domains
- wp_create_nonce doesn’t verify when using WP_List_Table
- Handling expired nonces
- What is really “wp_nonce_field” and how does it work? [duplicate]
- Cannot verify nonce
- wp_verify_nonce return false despite correct parameter passed
- WordPress JSON API nonces and Vue development server
- Verify a nonce in Form submission
- phpcs error in WordPress
- Stop WordPress nonces expiring
- Several nonces?
- Nonce keeps failing
- Public posts – preventing duplicate form submissions
- How to obtain “wp_rest” nonce for WP Statistics plugin manually?
- WordPress “nonce” message
- CSP nonces with Cloudflare Workers
- Why are nonces working in Firefox but not in Chrome?
- wp_verfy_nonce keeps giving false
- Nonce – reissue with ajax poll
- wp_nonce_url generating invalid links
- How to insert wp_nonce field within echoed string
- Nonce check causing issues when creating new post
- Weird nonce validation problem
- Logout button in menu without “wp” in links
- Check nonce in the new bulk_edit_posts action
- Are Nonces Useless?
- How to use nonce with front end submission form?
- Extend WordPress (4.x) session and nonce
- How do WordPress Nonces Work?
- Verify nonce in REST API?
- Do I require the use of nonce?
- Trash bin for categories
- Security – Ajax and Nonce use [closed]
- Undefined index: at_nonce in custom post metabox
- “Notice: Undefined index:” error when adding new content?
- Custom Meta Boxes – Nonce Issue – Move to trash issue
- Undelete post (untrash)?
- Is there an action that is called when a post is restored from the trash?
- get_post() function returns post even if it is trashed
- Exclude trash from save_post
- Properly applying nonce to a form using AJAX
- When is it useful to use wp_verify_nonce
- WordPress password reset – why post rp_key?
- How to save multiple metaboxes?
- Nonce actions and names available via open source
- wp_trash_post not firing
- Nonces, AJAX, script variables & security in WordPress
- Why does WordPress Heartbeat login not refresh the nonces?
- How to get the wpnonce value?
- How do I check if AJAX nonces are implemented correctly?
- What SQL / WordPress queries would need a nonce?
- Comment Spammed vs Trashed
- Identical wp_rest nonce returned from rest_api
- WP nonce invalid
- Why ajax doesn’t work on certain wordpress hooks and reload the page instead?
- Sort trash by date post was trashed
- Bypass nonce value while trashing a post
- How to retrieve the date on which a post was moved to trash?
- How to recover permanently deleted blog posts?
- Remove Featured Image & All Media Uploaded to the Post
- How to verify nonces in bulk?
- SQL Command for restoring trashed comments
- How to cancel an action hooked to untrash_post? or any hook
- Restrict access to trash, only admin
- Why do Metabox use Nonces?
- The Correct Way to Use Nonce Field without Settings API
- How can I specify the post status of an untrashed post?
- Cancelled orders move to Trash automatically in Woocommerce – how to disable?
- Restore page after deleting it from trash
- Does this code indicate an exploit?
- Using nonce when loading posts with AJAX
- Log in user using WordPress REST API
- Should wordpress nonce be placed in html form or in javascript file
- Extend Nonce Lifetime for Specific Nonce Creation
- Change button link to add nonce
- How do I mitigate replay attacks when talking about actions that shouldn’t happen twice?
- How can I verify WordPress nonce from the following code?
- How can i take all ids from untrash_post action?
- Nonce fail after second submit attempt
- wp_trash_post retrashes already trashed comments?
- get_option(‘sticky_posts’) returns stickies that are in trash
- when saveing $meta_box i get Undefined index error
- Metabox nonce not allowing update
- Create action running on trashed_post hook to modify post_meta value
- Is Nonce Verification (CSRF) required for WordPress Custom Bulk User Actions?
- wp_verify_nonce for comment form is not returning false