How to use hook admin_init for add_action for custom post type column
I'm adding a post thumbnail column to the edit custom post screen. The post thumbnails are showing up fine however I would like to hook it with admin_init to take some load off the website.
This is my code for adding the thumbnail's to my edit custom post screen:
add_filter( 'manage_edit-model_columns', 'my_columns_filter', 10, 1 );
function my_columns_filter( $columns ) {
$column_thumbnail = array( 'thumbnail' = 'Thumbnail' );
$columns = array_slice( $columns, 0, 1, true ) + $column_thumbnail + array_slice( $columns, 1, NULL, true );
return $columns;
}
add_action( 'manage_model_posts_custom_column', 'my_column_action', 10, 1 );
function my_column_action( $column ) {
global $post;
switch ( $column ) {
case 'thumbnail':
echo get_the_post_thumbnail( $post-ID, 'edit-screen-thumbnail' );
break;
}
}
Could someone explain (show me how) to use the admin_init hook for my thumbnail column code? Thanks.
Topic admin-init customization Wordpress
Category Web