Skip to content
July 26, 2024
  • How to change Font Family in WordPress any Theme ?
  • Top 10 Short URL Shorteners of 2024 | Earn Money
  • How to Add Short Description in Woocommerce in place of Excerpt on product page ?
  • How to add custom field in post wordpress ?

PurchaseTheme

We Support Freelancers & Small Businesses with FREE Tools & Templates

Newsletter
Random News
  • 3 Days Free Trial on Shopify & WordPress Website Development
  • About Us
  • Privacy Policy
  • PurchaseTheme’s Blog
Headlines
  • Font-Family-Nunito

    How to change Font Family in WordPress any Theme ?

    1 month ago1 month ago
  • TINLY: Best URL Shortener to Shorten Your Links

    Top 10 Short URL Shorteners of 2024 | Earn Money

    1 month ago1 month ago
  • Woocommerce Product Short Description

    How to Add Short Description in Woocommerce in place of Excerpt on product page ?

    2 months ago2 months ago
  • Custom-Field-In-Wordpress

    How to add custom field in post wordpress ?

    3 months ago2 months ago
  • Best Free Shopify Theme to Download and Install

    3 months ago2 months ago
  • Google site kit error invalid parameter: ‘site_id’

    Solved – WordPress site kit error invalid parameter: ‘site_id’

    3 months ago2 months ago
  • Home
  • Wordpress
  • How to add custom field in post wordpress ?
  • Wordpress

How to add custom field in post wordpress ?

admin3 months ago2 months ago04 mins
Custom-Field-In-Wordpress
Post Views: 189

Adding custom fields to WordPress posts is a common necessity, complementing the platform’s built-in features like tags and featured images.

While, WordPress offers robust functionality, custom fields enhance it by accommodating additional information tailored to specific needs. This could include diverse content such as text, images, links, or more complex data. Utilizing the default custom field functionality in WordPress provides a flexible solution, enabling users to extend their site’s capabilities without the need for extensive coding or plugins.

Whether for personalization, integration with external systems, or enhancing user experience, custom fields are invaluable in enriching WordPress content beyond its default offerings.

You have to follow the below step to add the custom fields & to get the custom field value in the code ( to get in the template files example header, footer, content, content top etc )

Step 1: Login to wordpress Admin

Step 2: Left menu “All Post”

Step 3: Click on “Edit” button to edit the post and on which you want to add custom field

Step 4: Now, click on the right side top 3 dots, check below image indication

Step 5: Once you click on “Preferences” a pop will option and it will provide option to enable “Custom fields”

Step 6: Enable it and click on “Show & Reload Page” button, a section to add the values will be appeared below:

Step 7: Now, lets put the “Status” in the name input and in Value add “Active” for this hello world post.

You will also get the option to delete or update

So, this how you are going to add the “Custom Field” Now, let us tell you how you are going to retrieve/get this field.

<?php
  echo get_post_meta( get_the_ID(), 'Status', true ); 
  echo '<br />';
  echo get_post_meta( get_the_ID(), 'date', true ); 
?>

From the array you can do it.

my_key - Your custom field name.
$mykey_values = get_post_custom_values( 'my_key' );

foreach ( $mykey_values as $key => $value ) {
	echo "$key => $value ( 'my_key' )<br />"; 
}

0 => First value ( 'my_key' )
1 => Second value ( 'my_key' )
2 => Third value ( 'my_key' )

If you still find any problem you can drop a comment and will surly get back to you in few hours. Also, you can drop us email at info@purchasetheme.com 
Tagged: add custom field to post WordPress add extra fields to WordPress post create custom fields in WordPress custom field CSS WordPress custom field filter WordPress post custom field options WordPress custom field search WordPress custom field WordPress tutorial custom metadata fields WordPress customize WordPress posts with fields Edit custom field WordPress export custom fields WordPress how to add custom field in WordPress post how to use custom field in WordPress page import custom fields WordPress manage custom fields WordPress using custom fields in WordPress WordPress advanced custom fields WordPress custom field date format WordPress custom field default value WordPress custom field display WordPress custom field image WordPress custom field plugin WordPress custom field shortcode WordPress custom field template WordPress custom field validation WordPress custom fields WordPress custom post types and fields WordPress post custom field array WordPress post meta

Post navigation

Previous: Best Free Shopify Theme to Download and Install
Next: How to Add Short Description in Woocommerce in place of Excerpt on product page ?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

Font-Family-Nunito

How to change Font Family in WordPress any Theme ?

admin1 month ago1 month ago 0
Woocommerce Product Short Description

How to Add Short Description in Woocommerce in place of Excerpt on product page ?

admin2 months ago2 months ago 0
  • General Issue
  • Opencart
  • Recurring Earning
  • Shopify
  • Url
  • URL Shortners
  • Wordpress
  • How to change Font Family in WordPress any Theme ?
  • Top 10 Short URL Shorteners of 2024 | Earn Money
  • How to Add Short Description in Woocommerce in place of Excerpt on product page ?
  • How to add custom field in post wordpress ?
  • Best Free Shopify Theme to Download and Install
PurchaseTheme Powered By BlazeThemes.