I adjusted the code for you. You can directly use the code in functions.php file. Here is more reference that can help you to understand more.
Link 1
Link 2
// Adding Custom Column
add_filter('manage_stfic_posts_columns', 'ST4_columns_head_only_stfic', 10);
add_action('manage_stfic_posts_custom_column', 'ST4_columns_content_only_stfic', 10, 2);
// CREATE TWO FUNCTIONS TO HANDLE THE COLUMN
function ST4_columns_head_only_stfic($defaults) {
$defaults['bookcode'] = 'Book Code';
return $defaults;
}
function ST4_columns_content_only_stfic($column_name, $post_ID) {
if ($column_name == 'bookcode') {
// Now you have to garb the meta value and show.
$book_code = get_post_meta($post_ID,'bookcode',true);
echo '<span>'.$book_code.'</span>';
}
}
Related Posts:
- Hide custom column in admin template screen (Elementor) [closed]
- custom field in admin columns
- Search & column order by meta value in admin
- Sort columns in the ‘Pages’ dashboard overview
- How can I display only the post titles from a selected category in columns?
- Can’t sort custom column on user.php by number / meta_value_num?
- Apply the_content filter to a custom field with multiple values
- Meta Query with AND & OR?
- Problem with serialized arrays in custom meta
- Adding another state (spam, reject, approve) to wordpress comments?
- WP doesn’t show Array Custom Fields?
- Filter archive.php by custom meta
- How do I search an array stored in a custom-field using WP_Query?
- Get updated meta data after save_post hook
- Custom text-only header
- How to save custom fields for attachments
- How to get a meta value from all post
- Adding existing user custom field value to a woocommerce product [closed]
- How to save values of a custom input field on the Network > Site Info screen
- How to reload the role specific registration form on validation errors?
- Exclude custom post type from search by custom field value?
- Currency (price) formating on custom fields
- Adding Custom Text Area to WooCommerce Product
- Get multiple custom field values in a $wpdb query [duplicate]
- add meta box using function.php
- Order by value in serialized custom field
- Custom image sizes for custom field media uploads
- converting custom field date format
- Buddypress Add unserialized Profile Fields in Members Loop [closed]
- Add Paypal Button programmatically
- How do I use wp_query for WordPress search?
- Nav Menu – Add class based on meta keys
- Eliminating the appearance of a specific custom field in a post
- Conditionally hide or show woocommerce product variation in fontend by custom field
- custom meta box text field: how to limit to alpha or numeric only
- Accessing loop functions (e.g the_title or the_content) from post ID
- Create an Array of Specific Custom Post Meta
- custom avatar removal
- Possible to add a meta field for css attribute to the editor Advanced panel?
- Excluding Specific Fields from Profile Builder Registration Form
- How to create a shortcode to print specific values stored in a post meta array?
- How to add upload video option in wordpress for user?
- Set post to unpublished after one week depending on condition
- Custom WP_Query for WordPress Search Results with meta_query
- Change order of posts
- Meta Query And/Or
- URL Rewrite fires when retrieving a custom value?
- How to store post meta in an array
- Efficiently sort only certain categories by custom field
- How can I do a variable for meta_query?
- Set checkbox as checked by default in a metabox
- ACF form edit front end post title does not change permalink
- How to list Category list in ACF Pro’s Select Field to choose from [closed]
- Singleton Custom Field (Meta Box)
- Can I use a Custom Field as the Featured Image URL?
- Display custom field & value correctly on page
- Displaying custom filed content instead of post content
- Copy price categories to custom field
- Save all the post tags inside a custom field
- Sanitize user input fields before wp_insert_post
- Use Advanced Custom Fields – replace line of code that hardcodes the tag into the template
- How to update a custom field in all posts with the value of another custom field in the same post?
- Advanced Custom Fields and Post Meta Fields Relation
- How to print the Custom fields values [closed]
- How to validation for sanitize_URL?
- How can I output the custom fields wrapping with HTML
- Custom metabox not working
- How to get custom image field of specific post id
- Populate wordpress menu with link to custom field value (file download)
- Selectively hiding or allowing thumbnails of featured images on front page
- wp_get_attachment_image_src() with advanced custom fields returning empty
- How to update custom field of a posts in a particular category
- Woocommerce products search with custom fields
- Convert author metadata to a custom field
- Custom pages or Custom Posts
- get_avatar filter is not working as per requirement
- Saving Custom Field that includes Quotation marks
- WordPress Admin – Automatically Sort Custom Posts by Custom Field Date Value in d-m-Y Fomat
- how to execute custom field for structured data?
- Saving custom form data
- select user with all meta field and field value. I am use Below Query for this ,So any of know another way to fast query instead of below query?
- register_form, custom field not submitted on first try
- meta_query ‘compare’ => ‘!=’ not working
- Echo out custom fields in comments
- Why WordPress takes time to make request to save post?
- Show comon custom field results?
- Filter query based on date in custom field
- Display Child Page with custom fields within Parent Page
- Convert all dates in field to Unix time, except those already in Unix time
- get_post_custom_values not working
- Pagination not displaying correct number of pages
- Show div based on custom meta value
- add multiple values (array) to post meta_input
- Assign class to Drop Down Selections in WooCommerce Products Custom Fields
- Show/Hide Featured Image or replace it with custom field [closed]
- Add fields to edit in custom widget
- custom field value is blank or empty
- How to add a custom field to the comments “Quick Edit” screen?
- Multiple triggers when publishing, saving or updating a post in WordPress
- If possible a field ID transfom in a Custom Field?