Display Post ID column in Post list WordPress
If you want to display post id column in post list in WordPress without plugin than you are in the right place. WordPress is a great tool for bloggers and content creators, but without the right customizations, it can be a little clunky. One of those areas? Displaying the post id column in your general list of posts.
Sure, you can easily view each post’s id if you’re editing it, but what if you want to be able to see all of your ids at once without going through each post? There’s a ton of functionality and features available in wordpress to make your website awesome.
Why display post id column in post list?
In the WordPress document management system, each post has a unique ID. This unique ID is stored in the database and allows you to identify it. It is important when you want to customize WordPress or create your own plugin because you can use the ID of a post to get the details of the post from the database.
If you have a developer working on your website, you may have to give them access to your WordPress dashboard for any number of reasons. In this scenario, it would be helpful for them to be able to see the post ID of your posts from within the dashboard.
By default, WordPress doesn’t show you the post IDs column in your Posts list. There are many plugins that will help you display the ID of a post on your website. However, sometimes it is better not to use a plugin for every little function, especially if it is a simple function like displaying a post ID column. In this post, i will see how we can do this without plugins.
You may also like:
Show image dimensions column in media library without plugin
Remove website URL field from WordPress comment form
Change WordPress Admin Dashboard Footer Text
Steps to display post id column in post list WordPress dashboard.
To get started, take a full backup of your website.
It is recommended to use this code snippet plugin if you are not familiar with eiditing functions.php
Use a child theme if you are editing functions.php file directly. Use this free plugin to create a child theme (you can delete the plugin after crateting child theme, but do not delete the parent theme).
1). Go to ‘Appearance’ then click on ‘Theme File Editor’.
Here you will find the option “Theme Functions”.
3). Add the below code or snippet to functions.php file then click on ‘Update File’.
/**
* display post id column in post list wordpress
*/
add_filter( 'manage_posts_columns', 'wpamit_add_id_column', 5 );
add_action( 'manage_posts_custom_column', 'wpamit_id_column_content', 5, 2 );
function wpamit_add_id_column( $columns ) {
$columns['wpamit_id'] = 'ID';
return $columns;
}
function wpamit_id_column_content( $column, $id ) {
if( 'wpamit_id' == $column ) {
echo $id;
}
}
It should look like the below image.
I hope you learned how to display post ID column in post list in WordPress admin. Please let us know if you have any questions, and we’ll be glad to help you in any way we can. If this article helps you, we would really appreciate it if you could share it with your friends on Facebook, Twitter, Instagram, Whatsapp, or any platform you like. Thank you and have a great day!