CP_Post_Revisions_List_Table::column_default( WP_Post $item, string $column_name )
Handles output for the default column.
Parameters
- $item
-
(Required) The current revision object.
- $column_name
-
(Required) Current column name.
Source
File: wp-admin/includes/class-cp-post-revisions-list-table.php
public function column_default( $item, $column_name ) {
$post_id = absint( $_GET['post_parent'] );
$post = get_post( $post_id );
switch ( $column_name ) {
case 'id':
return '<span>' . absint( $item->ID ) . '</span>';
case 'author':
return esc_html( get_the_author_meta( 'display_name', $post->post_author ) );
case 'revised':
return esc_html( get_the_author_meta( 'display_name', $item->post_author ) );
case 'date':
return date( 'j F Y H:i:s', strtotime( $item->post_date ) );
case 'view':
return '<button type="button" class="page-title-action">' . __( 'View' ) . '</button>';
case 'delete':
$delete_url = add_query_arg(
array(
'action' => 'delete',
'revision_id' => $item->ID,
'post_parent' => $post_id,
),
admin_url( 'revisions-list.php' )
);
$nonce_url = wp_nonce_url( $delete_url, 'delete_revision_' . $item->ID );
return '<a href="' . esc_url( $nonce_url ) . '">' . __( 'Delete' ) . '</a>';
default:
return '';
}
}
Changelog
| Version | Description |
|---|---|
| CP-2.6.0 | Introduced. CP-2.6.0 |