WordPress.org

Ready to get started?Download WordPress

Forums

How do I create a valid hyperlink to send a post to trash? (2 posts)

  1. cleverusername
    Member
    Posted 3 years ago #

    Hi

    It's a requirement that I add a new column to the list view of a custom post type. The column just needs a link for sending to trash, but I think I'm getting nonced. This is what I'm trying:

    $delete = 'ID . '&action=trash' ) . '">Delete';

    But keep getting:

    "Are you sure you want to do this?" "Please try again"

    Any help appreciated. Documentation in codex is a bit sparse on this stuff.

    Thanks

    Paul

  2. cleverusername
    Member
    Posted 3 years ago #

    oops, here's the code again:

    $delete = '<a href="' . wp_nonce_url( get_admin_url( ) . 'post.php?post=' . $post->ID . '&action=trash' ) . '">Delete</a>';

Topic Closed

This topic has been closed to new replies.

About this Topic