Create Custom Field in WordPress

Standard post in WordPress has only the main content area to enter the text to your post but when you need to add some custom piece of data to the post thesis there is no place to enter those details.

So you have the custom field to solve this problem.

You can add a custom field to post when creating a new post or edit an existing post in WordPress dashboard.

WP stores the custom fields as key and value pairs.

Now let’s see how to create the custom field name post_name where you can give different name than the existing title of the post.

How to create custom field

First you can create a new post or edit an existing post inside theĀ  WordPress admin.
You can see the following custom field Metabox below the post

Custom field metabox
Custom Field Metabox

Now you can enter new custom field in to the following form

Add New custom field
You can add custom field here

How to get custom field value?

You can retrieve a post meta field for the given post ID.

You can use the following function to get the custom field name.