How to add Extra Column of post Status in All post page

how can I add an extra admin column with the Status of posts like Below Image. i know admin column plugin for this work but i don't want to use any plugin..so please suggest me if there any code to add an extra admin column with the Post Status

Topic wp-admin Wordpress

Category Web


The last function doesn't work. Use this instead to fill the status column:

// Add the data to the post columns:
add_action( 'manage_post_posts_custom_column' , 'custom_post_column', 10, 2 );
function custom_post_column( $column, $post_id ) {
    if ( $column == "status" ) {
        echo get_post_status($post_id);
    }
}

This is the simplest use of adding custom columns:

// Add the custom columns to the post type:
add_filter( 'manage_post_posts_columns', 'set_custom_edit_book_columns' );
function set_custom_edit_book_columns($columns) {
    $columns['status'] = __( 'Status', 'your_text_domain' );  // or simply "Status";
    return $columns;
}

// Add the data to the post columns:
add_action( 'manage_post_posts_custom_column' , 'custom_post_column', 10, 2 );
function custom_post_column( $column, $post_id ) {
    if ( $column == "status" ) {
               $p_status = get_post_meta($post->ID, 'status', true);
                echo $p_publish;
    }
}

Of course you could also do this column sortable and so on! Not tested, but it should work, you've got the point

You could also check these links, discribing almost the same question as yours:

Add custom columns: http://www.deluxeblogtips.com/add-custom-column/

Add sortable columns: https://wordpress.org/support/topic/admin-column-sorting/

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.