{"id":7974,"date":"2026-05-07T12:22:32","date_gmt":"2026-05-07T10:22:32","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=7974"},"modified":"2026-05-07T12:22:33","modified_gmt":"2026-05-07T10:22:33","slug":"creating-custom-fields-and-content-types-in-wordpress-with-acf","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/","title":{"rendered":"Creating Custom Fields and Content Types in WordPress with ACF"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">WordPress is a highly flexible content management system, but its default &#8220;Post&#8221; and &#8220;Page&#8221; structures are often not enough for specialized websites. To transform WordPress into a true database-driven platform, developers use <strong>Advanced Custom Fields (ACF)<\/strong>. This allows you to store specific data\u2014like a book&#8217;s ISBN, a car&#8217;s mileage, or a project&#8217;s completion date\u2014in a structured way.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/#Context\" >Context<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/#Installing_and_Configuring_the_ACF_Plugin\" >Installing and Configuring the ACF Plugin<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/#Creating_Custom_Post_Types_CPT\" >Creating Custom Post Types (CPT)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/#Displaying_Custom_Fields_in_Your_Theme\" >Displaying Custom Fields in Your Theme<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/#Benefits_of_the_ACF_Workflow\" >Benefits of the ACF Workflow<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/#Practical_Implications\" >Practical Implications<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/creating-custom-fields-and-content-types-in-wordpress-with-acf\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Context\"><\/span>Context<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When you use ACF, you move away from trying to fit all your information into the standard WordPress text editor. Instead, you create a &#8220;Group&#8221; of specific inputs (fields) that only appear when you are editing a certain type of content. This keeps the administration panel clean and ensures data consistency across your site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Installing_and_Configuring_the_ACF_Plugin\"><\/span>Installing and Configuring the ACF Plugin<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<\/div>\n\n<div id=\"mybox-1743421814\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">The plugin acts as a visual interface for the WordPress Metadata API, allowing you to create complex data structures without writing SQL queries.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">1. Plugin Installation<\/h4>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Log in to your WordPress admin panel.<\/li>\n\n\n\n<li>Navigate to <strong>Plugins > Add New<\/strong>.<\/li>\n\n\n\n<li>Search for <strong>Advanced Custom Fields<\/strong>.<\/li>\n\n\n\n<li>Click <strong>Install Now<\/strong> and then <strong>Activate<\/strong>.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">2. Creating Custom Field Groups<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">A &#8220;Field Group&#8221; is a collection of fields that share the same display rules.<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>Go to the <strong>ACF<\/strong> (or <strong>Custom Fields<\/strong>) tab in your sidebar.<\/li>\n\n\n\n<li>Click <strong>Add New Group<\/strong> and give it a descriptive name, such as &#8220;Real Estate Details.&#8221;<\/li>\n\n\n\n<li><strong>Add Fields:<\/strong> Click the <strong>+ Add Field<\/strong> button.\n<ul class=\"wp-block-list\">\n<li><strong>Field Label:<\/strong> What the user sees (e.g., &#8220;Price&#8221;).<\/li>\n\n\n\n<li><strong>Field Name:<\/strong> What the code uses (e.g., <code>property_price<\/code>).<\/li>\n\n\n\n<li><strong>Field Type:<\/strong> Choose from text, images, date pickers, or even relationship links.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Location Rules:<\/strong> Define where these fields should appear. For example: &#8220;Show this field group if Post Type is equal to Property.&#8221;<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Creating_Custom_Post_Types_CPT\"><\/span>Creating Custom Post Types (CPT)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">While ACF manages the <em>data fields<\/em>, a Custom Post Type defines the <em>content container<\/em>. For example, if you are building a movie database, &#8220;Movies&#8221; would be your CPT, and &#8220;Director&#8221; would be an ACF field.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Adding CPT via Code<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">You can register a new content type by adding a function to your theme&#8217;s <code>functions.php<\/code> file:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PHP<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function register_my_cpts() {\n    $args = array(\n        'public' =&gt; true,\n        'label'  =&gt; 'Portfolio',\n        'supports' =&gt; array('title', 'editor', 'thumbnail'),\n        'menu_icon' =&gt; 'dashicons-portfolio',\n        'has_archive' =&gt; true,\n    );\n    register_post_type('portfolio', $args);\n}\nadd_action('init', 'register_my_cpts');\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Note: Modern versions of ACF (Pro and some free versions) now allow you to create Custom Post Types directly within the ACF user interface, removing the need for manual code.<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Displaying_Custom_Fields_in_Your_Theme\"><\/span>Displaying Custom Fields in Your Theme<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Unlike standard post content, ACF data does not appear automatically. You must tell your WordPress theme exactly where to display it by editing your template files (like <code>single.php<\/code> or <code>archive.php<\/code>).<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Basic Text Display<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To display a simple text field, use the <code>get_field()<\/code> function:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PHP<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n$price = get_field('property_price');\nif ($price) {\n    echo '&lt;div class=\"price\"&gt;Price: ' . esc_html($price) . '&lt;\/div&gt;';\n}\n?&gt;\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Displaying an Image<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">When using an Image field, it is best to set the &#8220;Return Format&#8221; to <strong>Image ID<\/strong> in the ACF settings for the best performance.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PHP<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n$image_id = get_field('project_gallery_image');\nif ($image_id) {\n    echo wp_get_attachment_image($image_id, 'large');\n}\n?>\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Benefits_of_the_ACF_Workflow\"><\/span>Benefits of the ACF Workflow<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>User-Friendly Data Entry:<\/strong> Clients or editors see specific boxes for specific information, preventing them from breaking the site&#8217;s layout.<\/li>\n\n\n\n<li><strong>Data Integrity:<\/strong> By choosing field types like &#8220;Date Picker&#8221; or &#8220;Number,&#8221; you ensure the data is always saved in the correct format.<\/li>\n\n\n\n<li><strong>Development Speed:<\/strong> You can build complex, bespoke layouts (like &#8220;Team&#8221; pages or &#8220;Product Specs&#8221;) much faster than coding custom meta boxes from scratch.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Practical_Implications\"><\/span>Practical Implications<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Performance:<\/strong> While ACF is efficient, loading dozens of fields on a single page can increase database queries. Use a caching plugin on your <strong>mybox-hosted<\/strong> site to keep response times fast.<\/li>\n\n\n\n<li><strong>ACF Pro:<\/strong> For advanced features like <strong>Repeater Fields<\/strong> (which let you add an unlimited list of items, like ingredients) or <strong>Flexible Content<\/strong>, you may need the Pro version of the plugin.<\/li>\n\n\n\n<li><strong>Search:<\/strong> By default, standard WordPress search does not look inside ACF fields. If you need this functionality, you may need an additional plugin like <em>SearchWP<\/em> or <em>Relevanssi<\/em>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Advanced Custom Fields transforms WordPress from a simple blogging tool into a professional-grade engine for complex data. By combining Custom Post Types with tailored ACF fields and simple PHP functions, you can display exactly the information your audience needs in a structured, beautiful layout.<\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[58,60],"manual_kb_tag":[8862,8863,8864,8865,190,421,485,7481,8860,8861],"class_list":["post-7974","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-web-applications-cms","manualknowledgebasecat-wordpress-plugins","manual_kb_tag-custom-post-types","manual_kb_tag-custom-fields","manual_kb_tag-field-groups","manual_kb_tag-metadata-api","manual_kb_tag-wordpress","manual_kb_tag-plugin-installation","manual_kb_tag-theme-development","manual_kb_tag-template-customization","manual_kb_tag-advanced-custom-fields","manual_kb_tag-acf-pro"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/7974","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/7974\/revisions"}],"predecessor-version":[{"id":7975,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/7974\/revisions\/7975"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=7974"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=7974"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=7974"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}