Title: Coding Custom Fields for Custom Post Types
Last modified: July 25, 2023

---

# Coding Custom Fields for Custom Post Types

 *  [provopeople](https://wordpress.org/support/users/provopeople/)
 * (@provopeople)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/coding-custom-fields-for-custom-post-types/)
 * Hi, I don’t really have much more than a basic plugin at this point with a Trains
   custom post type that works. I need to be able to track several properties per
   Train, including start/end dates, type of train (regular,themed,etc), capacity,
   etc.
 * I would like the back end marketing users to be able to enter a new Train in 
   wp-admin by using a date picker and to store the date as a date, not a string.
   
   I see that I can add custom fields but the values apparently can only be text.
   Then I’ve read some very old articles about metaboxes, but they don’t seem to
   support data types for the fields, such as a datetime type.
 * So two questions please:
 * First, with FSE and WordPress 6.x, are metaboxes still current? Every resource
   I find about coding them is very old.
 * Second, can I really do a datetime field with a metabox? Are there any data types
   for custom fields, short of using a plugin?
   I’d rather learn how to code this
   all up myself, I have a decent amount of CS knowledge. Thanks for any help!
    -  This topic was modified 2 years, 10 months ago by [provopeople](https://wordpress.org/support/users/provopeople/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Supratim Chatterjee](https://wordpress.org/support/users/papai40515/)
 * (@papai40515)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/coding-custom-fields-for-custom-post-types/#post-16923235)
 * So you have created a post type called Trains. So now you want to add custom 
   fields to that post type. Admin will fill those up right ?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/coding-custom-fields-for-custom-post-types/#post-16924888)
 * Yes, meta boxes are still possible, at least on the conventional editor screen.
   With FSE you’d probably want to implement a custom block. Custom post types wouldn’t
   normally use FSE?
 * You can place any sort of HTML you like in a custom meta box. A date picker is
   thus possible.
    [https://developer.wordpress.org/plugins/metadata/custom-meta-boxes/](https://developer.wordpress.org/plugins/metadata/custom-meta-boxes/)
 *  Thread Starter [provopeople](https://wordpress.org/support/users/provopeople/)
 * (@provopeople)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/coding-custom-fields-for-custom-post-types/#post-16925415)
 * That’s great thanks for the info wish I could upvote!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Coding Custom Fields for Custom Post Types’ is closed to new replies.

## Tags

 * [custom field](https://wordpress.org/support/topic-tag/custom-field/)
 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [datetime](https://wordpress.org/support/topic-tag/datetime/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 3 participants
 * Last reply from: [provopeople](https://wordpress.org/support/users/provopeople/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/coding-custom-fields-for-custom-post-types/#post-16925415)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
