{"id":473,"date":"2015-02-25T17:52:09","date_gmt":"2015-02-25T17:52:09","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=473"},"modified":"2015-04-20T17:05:19","modified_gmt":"2015-04-20T17:05:19","slug":"wordpress-adding-custom-fields-to-the-post","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/","title":{"rendered":"WordPress &#8211; Adding custom fields to the post"},"content":{"rendered":"<p>WordPress has a way where developers can create custom fields to the post. With this way we can extend WordPress functionality and fulfill our requirement. This extra custom fields data is known as meta-data. Meta data allow you to add some additional data to the post.<\/p>\n<p>In this tutorial we will discuss how to create WordPress custom fields and insert some additional data to the post. This step by step tutorial provides you an easy way to add custom post meta box in WordPress.<\/p>\n<p>Now we will add a custom meta box into post adding page. Through this custom meta box we will insert the author name of post. Also we will display the author name of respective post at the post listing page or post details page.<\/p>\n<p>All the meta box related working will be done in theme&#8217;s <code>functions.php<\/code> file. So, open the <code>functions.php<\/code> file of current active theme and follow the below steps.<\/p>\n<h2>Step 1: Adding Custom Meta Box<\/h2>\n<p><code>add_meta_box()<\/code> function is used to add meta boxes to the administrative interface. The below code is used for add meta box to the post.<\/p>\n<pre><span style=\"color: #000000\"><span style=\"color: #FF8000\">\/*<br \/>*&nbsp;Add&nbsp;the&nbsp;Custom&nbsp;Meta&nbsp;Box<br \/>*\/<br \/><br \/><\/span><span style=\"color: #007700\">function&nbsp;<\/span><span style=\"color: #0000BB\">add_custom_meta_box<\/span><span style=\"color: #007700\">()&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">add_meta_box<\/span><span style=\"color: #007700\">(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'custom_meta_box'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;$id<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'Custom&nbsp;Meta&nbsp;Box'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;$title&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'show_custom_meta_box'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;$callback<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'post'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;$page<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'normal'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;$context<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'high'&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;$priority<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">);&nbsp;<br \/>}<br \/><\/span><span style=\"color: #0000BB\">add_action<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'add_meta_boxes'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'add_custom_meta_box'<\/span><span style=\"color: #007700\">);<\/span><\/span><\/pre>\n<h2>Step 2: Rendering Custom Meta Box<\/h2>\n<p>In the following code, we have generated an array of custom meta fields. Now we have to define the callback function (<code>show_custom_meta_box()<\/code>) and generate the view of the meta box into this function (<code>show_custom_meta_box()<\/code>).<\/p>\n<pre><span style=\"color: #000000\"><span style=\"color: #FF8000\">\/\/&nbsp;Custom&nbsp;meta&nbsp;fields&nbsp;array<br \/><\/span><span style=\"color: #0000BB\">$prefix&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'custom_'<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">$custom_meta_fields&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;array(<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'label'<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Author&nbsp;Name'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'desc'&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'Enter&nbsp;post&nbsp;author&nbsp;name&nbsp;to&nbsp;be&nbsp;displayed'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'id'&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #0000BB\">$prefix<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #DD0000\">'author_name'<\/span><span style=\"color: #007700\">,<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #DD0000\">'type'&nbsp;&nbsp;<\/span><span style=\"color: #007700\">=&gt;&nbsp;<\/span><span style=\"color: #DD0000\">'text'<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">)<br \/>);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;The&nbsp;callback&nbsp;function<br \/><\/span><span style=\"color: #007700\">function&nbsp;<\/span><span style=\"color: #0000BB\">show_custom_meta_box<\/span><span style=\"color: #007700\">()&nbsp;{<br \/><br \/>&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;<\/span><span style=\"color: #0000BB\">$custom_meta_fields<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$post<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Use&nbsp;nonce&nbsp;for&nbsp;verification<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;input&nbsp;type=\"hidden\"&nbsp;name=\"custom_meta_box_nonce\"&nbsp;value=\"'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">wp_create_nonce<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">basename<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">__FILE__<\/span><span style=\"color: #007700\">)).<\/span><span style=\"color: #DD0000\">'\"&nbsp;\/&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Begin&nbsp;the&nbsp;field&nbsp;table&nbsp;and&nbsp;loop<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;table&nbsp;class=\"form-table\"&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(<\/span><span style=\"color: #0000BB\">$custom_meta_fields&nbsp;<\/span><span style=\"color: #007700\">as&nbsp;<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;get&nbsp;value&nbsp;of&nbsp;this&nbsp;field&nbsp;if&nbsp;it&nbsp;exists&nbsp;for&nbsp;this&nbsp;post<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$meta&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">get_post_meta<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$post<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">ID<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">],&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;begin&nbsp;a&nbsp;table&nbsp;row&nbsp;with<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;tr&gt;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;th&gt;&lt;label&nbsp;for=\"'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">].<\/span><span style=\"color: #DD0000\">'\"&gt;'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'label'<\/span><span style=\"color: #007700\">].<\/span><span style=\"color: #DD0000\">'&lt;\/label&gt;&lt;\/th&gt;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;td&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch(<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'type'<\/span><span style=\"color: #007700\">])&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;text&nbsp;field<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">case&nbsp;<\/span><span style=\"color: #DD0000\">'text'<\/span><span style=\"color: #007700\">:<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;input&nbsp;type=\"text\"&nbsp;name=\"'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">].<\/span><span style=\"color: #DD0000\">'\"&nbsp;id=\"'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">].<\/span><span style=\"color: #DD0000\">'\"&nbsp;value=\"'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$meta<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #DD0000\">'\"&nbsp;size=\"30\"&nbsp;\/&gt;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&nbsp;\/&gt;&lt;span&nbsp;class=\"description\"&gt;'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'desc'<\/span><span style=\"color: #007700\">].<\/span><span style=\"color: #DD0000\">'&lt;\/span&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br \/>nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;\/td&gt;&lt;\/tr&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'&lt;\/table&gt;'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>}<\/span><\/span><\/pre>\n<p><span class=\"glyphicon glyphicon-hand-right\"><\/span>&nbsp;Go to the post adding page and you can see the custom meta box and custom post fields under the post content editor. Into this field you can add the custom author name of the post.<\/p>\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-custom-meta-box-fields-to-post.png\" alt=\"wordpress-custom-meta-box-fields-to-post\" width=\"493\" height=\"166\" class=\"alignnone size-full wp-image-474\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-custom-meta-box-fields-to-post.png 493w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-custom-meta-box-fields-to-post-300x101.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-custom-meta-box-fields-to-post-170x57.png 170w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\" \/><\/div>\n<h2>Step 3: Saving Custom Meta Data<\/h2>\n<p>Now it&#8217;s time to save the meta data. The below code is use to save the post meta data.<\/p>\n<pre><span style=\"color: #000000\"><span style=\"color: #FF8000\">\/\/&nbsp;Save&nbsp;the&nbsp;custom&nbsp;meta&nbsp;data<br \/><\/span><span style=\"color: #007700\">function&nbsp;<\/span><span style=\"color: #0000BB\">save_custom_meta<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">)&nbsp;{<br \/><br \/>&nbsp;&nbsp;&nbsp;&nbsp;global&nbsp;<\/span><span style=\"color: #0000BB\">$custom_meta_fields<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;verify&nbsp;nonce<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if&nbsp;(!<\/span><span style=\"color: #0000BB\">wp_verify_nonce<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'custom_meta_box_nonce'<\/span><span style=\"color: #007700\">],&nbsp;<\/span><span style=\"color: #0000BB\">basename<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">__FILE__<\/span><span style=\"color: #007700\">)))&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;check&nbsp;autosave<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if&nbsp;(<\/span><span style=\"color: #0000BB\">defined<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'DOING_AUTOSAVE'<\/span><span style=\"color: #007700\">)&nbsp;&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">DOING_AUTOSAVE<\/span><span style=\"color: #007700\">)<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;check&nbsp;permissions<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">if&nbsp;(<\/span><span style=\"color: #DD0000\">'page'&nbsp;<\/span><span style=\"color: #007700\">==&nbsp;<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'post_type'<\/span><span style=\"color: #007700\">])&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!<\/span><span style=\"color: #0000BB\">current_user_can<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'edit_page'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">))<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;(!<\/span><span style=\"color: #0000BB\">current_user_can<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'edit_post'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">))&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;loop&nbsp;through&nbsp;fields&nbsp;and&nbsp;save&nbsp;the&nbsp;data<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">foreach&nbsp;(<\/span><span style=\"color: #0000BB\">$custom_meta_fields&nbsp;<\/span><span style=\"color: #007700\">as&nbsp;<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$old&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">get_post_meta<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">],&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$new&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$_POST<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">]];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(<\/span><span style=\"color: #0000BB\">$new&nbsp;<\/span><span style=\"color: #007700\">&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">$new&nbsp;<\/span><span style=\"color: #007700\">!=&nbsp;<\/span><span style=\"color: #0000BB\">$old<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">update_post_meta<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">],&nbsp;<\/span><span style=\"color: #0000BB\">$new<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;elseif&nbsp;(<\/span><span style=\"color: #DD0000\">''&nbsp;<\/span><span style=\"color: #007700\">==&nbsp;<\/span><span style=\"color: #0000BB\">$new&nbsp;<\/span><span style=\"color: #007700\">&amp;&amp;&nbsp;<\/span><span style=\"color: #0000BB\">$old<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">delete_post_meta<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$post_id<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$field<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'id'<\/span><span style=\"color: #007700\">],&nbsp;<\/span><span style=\"color: #0000BB\">$old<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>}<br \/><\/span><span style=\"color: #0000BB\">add_action<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'save_post'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'save_custom_meta'<\/span><span style=\"color: #007700\">);<\/span><\/span><\/pre>\n<h2>Step 4: Get Meta Data and Display the Custom Field Value<\/h2>\n<p><code>get_post_meta()<\/code> function returns the values of the custom fields with the specified key from the specified post. We will get all the custom meta data and display custom field value from custom meta data array by specific meta key.<\/p>\n<pre><span style=\"color: #000000\"><span style=\"color: #0000BB\">&lt;?php&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;the&nbsp;post&nbsp;meta&nbsp;data<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$meta&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">get_post_meta<\/span><span style=\"color: #007700\">(&nbsp;<\/span><span style=\"color: #0000BB\">get_the_ID<\/span><span style=\"color: #007700\">()&nbsp;);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Get&nbsp;custom&nbsp;meta&nbsp;value<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$post_author_name&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$meta<\/span><span style=\"color: #007700\">[<\/span><span style=\"color: #DD0000\">'custom_author_name'<\/span><span style=\"color: #007700\">][<\/span><span style=\"color: #0000BB\">0<\/span><span style=\"color: #007700\">];<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<\/span><span style=\"color: #DD0000\">'Author:&nbsp;'<\/span><span style=\"color: #007700\">.<\/span><span style=\"color: #0000BB\">$post_author_name<\/span><span style=\"color: #007700\">;<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/span><\/pre>\n<p>\n<span class=\"glyphicon glyphicon-hand-right\"><\/span>&nbsp;You can see the custom meta field value into the post display. The custom author name of the respective post would be displayed.<\/p>\n<div class=\"img_center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/display-custom-meta-value-wordpress1.png\" alt=\"display-custom-meta-value-wordpress\" width=\"816\" height=\"469\" class=\"alignnone size-full wp-image-482\" srcset=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/display-custom-meta-value-wordpress1.png 816w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/display-custom-meta-value-wordpress1-300x172.png 300w, https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/display-custom-meta-value-wordpress1-170x98.png 170w\" sizes=\"auto, (max-width: 816px) 100vw, 816px\" \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>WordPress has a way where developers can create custom fields to the post. With this way we can extend WordPress functionality and fulfill our requirement. This extra custom fields data is known as meta-data. Meta <\/p>\n","protected":false},"author":1,"featured_media":544,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-473","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","cat-5-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WordPress - Adding custom fields to the post - CodexWorld<\/title>\n<meta name=\"description\" content=\"Extend WordPress with custom fields - Add custom post meta box in WordPress. Learn how to create WordPress custom fields to post.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress - Adding custom fields to the post - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"Extend WordPress with custom fields - Add custom post meta box in WordPress. Learn how to create WordPress custom fields to post.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2015-02-25T17:52:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-04-20T17:05:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"424\" \/>\n\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"WordPress &#8211; Adding custom fields to the post\",\"datePublished\":\"2015-02-25T17:52:09+00:00\",\"dateModified\":\"2015-04-20T17:05:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/\"},\"wordCount\":361,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png\",\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/\",\"name\":\"WordPress - Adding custom fields to the post - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png\",\"datePublished\":\"2015-02-25T17:52:09+00:00\",\"dateModified\":\"2015-04-20T17:05:19+00:00\",\"description\":\"Extend WordPress with custom fields - Add custom post meta box in WordPress. Learn how to create WordPress custom fields to post.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2015\\\/02\\\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png\",\"width\":424,\"height\":350,\"caption\":\"wordpress-adding-custom-fields-to-the-post-by-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/wordpress-adding-custom-fields-to-the-post\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress &#8211; Adding custom fields to the post\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress - Adding custom fields to the post - CodexWorld","description":"Extend WordPress with custom fields - Add custom post meta box in WordPress. Learn how to create WordPress custom fields to post.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/","og_locale":"en_US","og_type":"article","og_title":"WordPress - Adding custom fields to the post - CodexWorld","og_description":"Extend WordPress with custom fields - Add custom post meta box in WordPress. Learn how to create WordPress custom fields to post.","og_url":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2015-02-25T17:52:09+00:00","article_modified_time":"2015-04-20T17:05:19+00:00","og_image":[{"width":424,"height":350,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"WordPress &#8211; Adding custom fields to the post","datePublished":"2015-02-25T17:52:09+00:00","dateModified":"2015-04-20T17:05:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/"},"wordCount":361,"commentCount":4,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png","articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/","url":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/","name":"WordPress - Adding custom fields to the post - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png","datePublished":"2015-02-25T17:52:09+00:00","dateModified":"2015-04-20T17:05:19+00:00","description":"Extend WordPress with custom fields - Add custom post meta box in WordPress. Learn how to create WordPress custom fields to post.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png","width":424,"height":350,"caption":"wordpress-adding-custom-fields-to-the-post-by-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/wordpress-adding-custom-fields-to-the-post\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"WordPress &#8211; Adding custom fields to the post"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2015\/02\/wordpress-adding-custom-fields-to-the-post-by-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-7D","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=473"}],"version-history":[{"count":5,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/473\/revisions"}],"predecessor-version":[{"id":483,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/473\/revisions\/483"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/544"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}