{"id":42541,"date":"2019-03-01T13:46:55","date_gmt":"2019-03-01T19:46:55","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=resource&#038;p=42541"},"modified":"2019-03-01T13:46:55","modified_gmt":"2019-03-01T19:46:55","slug":"custom-fields-wordpress","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/","title":{"rendered":"WordPress Custom Fields"},"content":{"rendered":"<p>When writing content for your WordPress site, you\u2019ll probably have noticed that certain basic details are always displayed. These include author names, dates, titles, and so on. <a href=\"https:\/\/code.tutsplus.com\/tutorials\/understanding-and-working-with-metadata-in-wordpress--cms-21034\">This information is called metadata<\/a>, and WordPress usually creates it automatically.<\/p>\n<p>By using your own custom fields, however, you can edit your posts\u2019 and pages\u2019 metadata to display whatever you want. The custom fields tool is usually hidden by default, but you can easily enable and start using it. What\u2019s more, there are plugins that help to refine this useful feature even further.<\/p>\n<p>In this post, we\u2019re going to explain what custom fields are and how to implement them in WordPress. Let\u2019s get to work!<\/p>\n<h2>What Is a WordPress Custom Field?<\/h2>\n<p><a href=\"https:\/\/codex.wordpress.org\/Custom_Fields\">WordPress custom fields<\/a> enable you to add additional information to your posts and pages. As we mentioned earlier, these details are stored as \u2018metadata\u2019. To display that metadata, you can make a few basic alterations to your WordPress theme.<\/p>\n<p>WordPress posts come with some basic metadata already, but custom fields give you an opportunity to add more. You can include any information you like in them. This could be ratings for products you\u2019re writing about, for example, or even music you are listening to as you write each post.<\/p>\n<h2>Why Use WordPress Custom Fields?<\/h2>\n<p>WordPress custom fields permit you greater control over your website. However, that isn\u2019t their only benefit.<\/p>\n<p>Using custom fields also gives you an opportunity to be more transparent with your website visitors. These fields let you add information that would otherwise not be displayed. Some of these details help your audience relate with your content at a deeper level.<\/p>\n<p>For instance, displaying the mood you were in when writing a post can help readers interpret it in the right way. As another example, adding dates to specific content makes it clear when the information within might no longer be relevant.<\/p>\n<p>Advanced custom fields are used on a lot of WordPress websites, but are most useful for larger sites with a lot of content. This can include multi-author blogs, e-commerce and business portals, and even <a href=\"https:\/\/wpml.org\/documentation\/support\/custom-types-and-fields-for-multilingual-sites\/\">multilingual sites<\/a>.<\/p>\n<h2>How to Implement WordPress Custom Fields<\/h2>\n<p>In order to add WordPress custom fields to your content, you will first need to open up the page or post you\u2019d like to use. Then, you can simply walk through the following three steps.<\/p>\n<h3>Step 1: Enable Custom Fields<\/h3>\n<p>Custom fields are hidden by default on most WordPress sites. To make them visible, select the <em>Screen Options<\/em> tab at the top of any WordPress editor page, and choose <em>Custom Fields<\/em>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-42542\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource1.png\" alt=\"custom fields wordpress\" width=\"512\" height=\"172\" srcset=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource1.png 512w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource1-300x101.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>This will open a new dialog box below the post or page editor.<\/p>\n<h3>Step 2: Create a Custom Field<\/h3>\n<p>In the new <em>Custom Fields<\/em> box, click on <em>Enter New<\/em> to create your first custom field:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-42543\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource2.png\" alt=\"wordpress custom fields\" width=\"512\" height=\"123\" srcset=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource2.png 512w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource2-300x72.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>Give your custom field a simple and descriptive name. Then, enter the information you want to display in the <em>Value<\/em> box. In our example, we\u2019re creating a custom field that will display what song the author was listening to while writing the post, so we\u2019ve entered the song\u2019s title under <em>Value<\/em>.<\/p>\n<h3>Step 3: Add Code to Your Theme File<\/h3>\n<p>Once you\u2019re done with the previous step, select <em>Add Custom Field<\/em>. This assigns the information to your post as new metadata, but won\u2019t display it on your site yet.<\/p>\n<p>To make that happen, you need to add some code to your WordPress theme. Head to <em>Appearance<\/em> &gt; <em>Editor<\/em>, and look for the<em> single.php<\/em> file:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-42544\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource3.png\" alt=\"custom fields in wordpress\" width=\"512\" height=\"242\" srcset=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource3.png 512w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource3-300x142.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>Here, you can add any code you like, depending on how you want your custom metadata displayed. Just make sure you add it before the line:<\/p>\n<pre>&lt;?php endwhile; \/\/ end of the loop. ?&gt;<\/pre>\n<p>As an example, we could use the following code to display the song title we entered in the last step:<\/p>\n<pre>&lt;p&gt;Listening to: &lt;?php echo get_post_meta($post-&gt;ID, 'song-title', true); ?&gt;<\/pre>\n<p>Again, you can use just about any code here, simple or complex. The only limit to what you can accomplish using WordPress custom fields is your own creativity.<\/p>\n<h2>Top Custom Fields Plugins<\/h2>\n<p>The above process works just fine for adding custom fields to your WordPress content. However, you can also use plugins to simplify the process and expand your options. Let\u2019s look at a few tools that can help you get the most out of the custom fields feature.<\/p>\n<h3>1. <a href=\"https:\/\/wordpress.org\/plugins\/advanced-custom-fields\/\">Advanced Custom Fields<\/a><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-42545\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource4.png\" alt=\"custom field plugins\" width=\"512\" height=\"160\" srcset=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource4.png 512w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource4-300x94.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p><a href=\"https:\/\/wordpress.org\/plugins\/advanced-custom-fields\/\">Advanced Custom Fields<\/a> boasts a clear and friendly interface design, which makes even its more complex features easy to use. It lets you add custom fields nearly anywhere on your site, customize them, and display them however you\u2019d like.<\/p>\n<p>This plugin also provides you with more than 30 custom field types to use, including email, text, number, image, and password fields. If you like, there\u2019s also <a href=\"https:\/\/www.advancedcustomfields.com\/pro\/\">a Pro version<\/a> with even more features.<\/p>\n<h3>2. <a href=\"https:\/\/wordpress.org\/plugins\/pods\/\">Pods<\/a><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-42546\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource5.png\" alt=\"plugins for custom fields\" width=\"512\" height=\"165\" srcset=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource5.png 512w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource5-300x97.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p><a href=\"https:\/\/wordpress.org\/plugins\/pods\/\">Pods<\/a> is another plugin that greatly expands what you can do with your WordPress custom fields. It provides a clean interface that lets you manage your fields and customize them fully. In addition, it offers a variety of display options.<\/p>\n<p>This handy plugin includes more than just custom fields functionality, however. Pods also helps you manage custom post types, categories and tags, and a lot more. If you&#8217;re looking for a tool that can help you get a lot more control over your WordPress content, this is one to check out.<\/p>\n<h3>3. <a href=\"https:\/\/wordpress.org\/plugins\/custom-field-suite\/\">Custom Field Suite<\/a><\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-42547\" src=\"https:\/\/wpengine.com\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource6.png\" alt=\"custom fields wordpress plugins\" width=\"512\" height=\"174\" srcset=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource6.png 512w, https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource6-300x102.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/p>\n<p>The previous two custom fields plugins are very feature-heavy, which can be handy for advanced users. However, what if you want something a bit simpler and more straightforward? That&#8217;s where <a href=\"https:\/\/wordpress.org\/plugins\/custom-field-suite\/\">Custom Field Suite<\/a> comes into the picture.<\/p>\n<p>This plugin provides only the functionality you need to manage your custom fields more fully, without any extra frills. It includes 14 field types, such as text, date, term, and user fields. It&#8217;s also very lightweight, so it should have little to no impact on your site&#8217;s performance.<\/p>\n<h2>Support for More WordPress and Digital Experience from WP Engine<\/h2>\n<p>If you are just starting out with WordPress custom fields, you might need help with the technical aspects. Here at WP Engine, we are all about helping to make your WordPress website work for you. Of course, we also provide <a href=\"https:\/\/wpengine.com\/plans\/\">reliable and powerful hosting plans<\/a>, along with a stellar support team.<\/p>\n<p>For all your WordPress needs, we\u2019d recommend checking out our <a href=\"https:\/\/wpengine.com\/resources\/\">Resource Center<\/a>. There, you can find lots of essential information on WordPress, eCommerce, SEO, security, analytics, uptime, and so much more!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When writing content for your WordPress site, you\u2019ll probably have noticed that certain basic details are always displayed. These include author names, dates, titles, and so on. This information is called metadata, and WordPress usually creates it automatically. By using your own custom fields, however, you can edit your posts\u2019 and pages\u2019 metadata to display<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":177,"featured_media":0,"template":"","resource-topic":[904,901],"resource-role":[896,906,897,899],"resource-type":[916],"class_list":["post-42541","resource","type-resource","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding Custom Fields in WordPress | WP Engine\u00ae<\/title>\n<meta name=\"description\" content=\"Add additional information to your website when you use WordPress custom fields tool. Learn about how to add this tool to your page and why your website will benefit.\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding Custom Fields in WordPress | WP Engine\u00ae\" \/>\n<meta property=\"og:description\" content=\"Add additional information to your website when you use WordPress custom fields tool. Learn about how to add this tool to your page and why your website will benefit.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/\",\"url\":\"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/\",\"name\":\"Adding Custom Fields in WordPress | WP Engine\u00ae\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2019-03-01T19:46:55+00:00\",\"dateModified\":\"2019-03-01T19:46:55+00:00\",\"description\":\"Add additional information to your website when you use WordPress custom fields tool. Learn about how to add this tool to your page and why your website will benefit.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"WordPress Custom Fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/aba73ed4c15eda43b5fd78844ec31fad\",\"name\":\"Samantha Rodriguez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g\",\"caption\":\"Samantha Rodriguez\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding Custom Fields in WordPress | WP Engine\u00ae","description":"Add additional information to your website when you use WordPress custom fields tool. Learn about how to add this tool to your page and why your website will benefit.","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"Adding Custom Fields in WordPress | WP Engine\u00ae","og_description":"Add additional information to your website when you use WordPress custom fields tool. Learn about how to add this tool to your page and why your website will benefit.","og_url":"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","og_image":[{"url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resource1.png"}],"twitter_card":"summary_large_image","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/","url":"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/","name":"Adding Custom Fields in WordPress | WP Engine\u00ae","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2019-03-01T19:46:55+00:00","dateModified":"2019-03-01T19:46:55+00:00","description":"Add additional information to your website when you use WordPress custom fields tool. Learn about how to add this tool to your page and why your website will benefit.","breadcrumb":{"@id":"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/case-studies\/resources\/custom-fields-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"WordPress Custom Fields"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/aba73ed4c15eda43b5fd78844ec31fad","name":"Samantha Rodriguez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g","caption":"Samantha Rodriguez"}}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/10\/add-custom-fields-resourcegrid.jpg","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Developer, Entrepreneur, Freelancer, Site Owner","topic":"<strong>Topics:<\/strong> Marketing, WordPress","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/42541","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/177"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=42541"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=42541"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=42541"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=42541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}