Adding a text link under the post title in the lists of posts

I made a lot of changes to my WP settings and now, when I approve and publish pending posts, authors have one hour to modify their articles.
After the hour has gone the edit link disappear and they can’t change anymore.
I need to give them the opportunity to remove the post but the “trash” link has gone either.
I’ve been thinking about adding a new text link under the post title to let the authors send me a message asking to delete the post.
The text link should have the name of the post as subject in order to understand wich post need to be removed.
Is this possible?
Thanks

Related posts

Leave a Reply

1 comment

  1. You can enhance, change the strings to each post title in the table view of backend on post via hook:

    add_filter( 'post_row_actions', array( $this, 'add_archive_link' ), 10, 2 );

    See the result in this screenshot:

    enter image description here

    Below you find my method to add a link

        /**
         * Add link on archive
         *
         * @uses   get_post_type_object, get_archive_post_link, current_user_can, esc_attr
         * @access public
         * @since  0.0.1
         * @param  array string $actions
         * @param  integer $id
         * @return array $actions
         */
        public function add_archive_link( $actions, $id ) {
            global $post, $current_screen, $mode;
    
            $post_type_object = get_post_type_object( $post->post_type );
    
            if ( is_array( $this->def_archive_screens ) && ! in_array( $current_screen->id, $this->def_archive_screens ) )
                return $actions;
            if ( ! current_user_can( $post_type_object->cap->delete_post, $post->ID ) )
                return $actions;
    
            $actions['archive'] = '<a href="' . $this->get_archive_post_link( $post->ID ) 
                . '" title="'
                . esc_attr( __( 'Move this item to the Archive', $this->textdomain  ) ) 
                . '">' . __( 'Archive', $this->textdomain  ) . '</a>';
    
            return $actions;
        }
    

    You must use the hook admin_action_{your_string} for the callback, if the user click on the link. Also below a example for my string archive:

        add_action( 'admin_action_archive', array( $this, 'archive_post_type' ) );
    

    Now the method for the hook:

        /**
         * Archive post type
         *
         * @uses   wp_die, set_post_type, add_post_meta, wp_redirect, admin_url
         * @access public
         * @since  0.0.1
         * @return void
         */
        public function archive_post_type () {
    
            if ( ! (
                isset( $_GET['post']) || 
                ( isset( $_REQUEST['action']) && 'archive' == $_REQUEST['action'] ) 
            ) ) {
                wp_die( __( 'No post to archive has been supplied!', $this->textdomain ) );
            }
    
            $id = (int) ( isset( $_GET['post']) ? $_GET['post'] : $_REQUEST['post']);
    
            if ( $id ) {
                $redirect_post_type = '';
                $archived_post_type = get_post_type( $id );
                if ( ! empty( $archived_post_type ) )
                    $redirect_post_type = 'post_type=' . $archived_post_type . '&';
                // change post type
                set_post_type( $id, $this->post_type_1 );
                // add old post_type to post meta
                add_post_meta( $id, $this->post_meta_key, $archived_post_type, TRUE );
                wp_redirect( admin_url( 'edit.php?' . $redirect_post_type . 'archived=1&ids=' . $id ) );
                exit;
            } else {
                wp_die( __( 'Sorry, i cant find the post-id', $this->textdomain ) );
            }
    
        }
    

    You find a plugin, there use this on github.