{"id":1031,"date":"2026-11-20T19:02:02","date_gmt":"2026-11-20T18:02:02","guid":{"rendered":"https:\/\/mywebfriend.net\/?p=1031"},"modified":"2026-11-20T19:04:53","modified_gmt":"2026-11-20T18:04:53","slug":"wordpress-custom-post-types-acf-code","status":"publish","type":"post","link":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/","title":{"rendered":"WordPress Custom Post Types: when to use them and how to create them with ACF or code"},"content":{"rendered":"<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 fusion-flex-container nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row fusion-flex-align-items-flex-start fusion-flex-content-wrap\" style=\"max-width:1420.64px;margin-left: calc(-4% \/ 2 );margin-right: calc(-4% \/ 2 );\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-flex-column\" style=\"--awb-bg-blend:overlay;--awb-bg-size:cover;--awb-width-large:100%;--awb-margin-top-large:0px;--awb-spacing-right-large:1.92%;--awb-margin-bottom-large:0px;--awb-spacing-left-large:1.92%;--awb-width-medium:100%;--awb-spacing-right-medium:1.92%;--awb-spacing-left-medium:1.92%;--awb-width-small:100%;--awb-spacing-right-small:1.92%;--awb-spacing-left-small:1.92%;\"><div class=\"fusion-column-wrapper fusion-flex-justify-content-flex-start fusion-content-layout-column\"><div class=\"fusion-text fusion-text-1\"><p>A <strong>WordPress Custom Post Type<\/strong> is not simply a way to create more pages on a website. It is used to represent content with its own editorial identity: something published repeatedly, with recurring data, that may need an archive, filters, relationships, and a dedicated template.<\/p>\n<p>A typical example is a website that publishes events. Each event has a title, description, date, price, registration details, and perhaps speakers or a venue. Treating these items as regular posts soon makes it difficult to keep data consistent and build useful pages. A CPT lets you model the content before you even design its layout.<\/p>\n<h2>When a Custom Post Type is the right choice<\/h2>\n<h3>How it differs from posts and pages<\/h3>\n<p>WordPress already includes native post types such as posts, pages, and attachments. With <code>register_post_type()<\/code>, you can register additional types with their own admin screen, permalinks, archive, taxonomies, capabilities, and selected supports.<\/p>\n<p>A CPT does not automatically create a new database table: its content is stored in the standard posts table and distinguished by the <code>post_type<\/code> value. However, it can have public-facing and administrative rules that are completely different from regular posts.<\/p>\n<p>A CPT is appropriate when content:<\/p>\n<ul>\n<li>is created and updated repeatedly;<\/li>\n<li>has recurring properties, such as a date, price, address, or attached document;<\/li>\n<li>deserves its own single page, archive, or filters;<\/li>\n<li>needs to be reused across several sections of the website;<\/li>\n<li>requires relationships, permissions, or a separate editorial workflow.<\/li>\n<\/ul>\n<p>For events, for example, an archive of upcoming dates and filters by event type can be genuinely useful. The same reasoning applies to courses, properties, case studies, downloadable resources, or team members.<\/p>\n<p>Do not create a CPT for a single corporate page, for posts that differ only by category, or for a purely visual requirement that can be handled with blocks and templates. Also avoid it when a specialized plugin already manages the required functional domain correctly. A CPT does not provide automatic SEO benefits: pages and archives must serve a practical purpose for people looking for information.<\/p>\n<h2>CPTs, taxonomies, ACF fields, and relationships: designing the model<\/h2>\n<p>The most useful decision happens before installing plugins or writing code. For the events example, each piece of information should be assigned to the right tool.<\/p>\n<div class=\"table-1\">\n<table style=\"width: 100%;\">\n<thead>\n<tr>\n<th>Requirement<\/th>\n<th>Tool<\/th>\n<th>Example<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Entity with its own page and editorial lifecycle<\/td>\n<td>Custom Post Type<\/td>\n<td>Event, course, property<\/td>\n<\/tr>\n<tr>\n<td>Shared, navigable classification<\/td>\n<td>Taxonomy<\/td>\n<td>Event type, industry<\/td>\n<\/tr>\n<tr>\n<td>Data belonging to a single item<\/td>\n<td>Custom field<\/td>\n<td>Date, price, registration URL<\/td>\n<\/tr>\n<tr>\n<td>Internal list without its own identity<\/td>\n<td>Repeater or field group<\/td>\n<td>Day schedule, FAQs<\/td>\n<\/tr>\n<tr>\n<td>Related entity with its own pages<\/td>\n<td>Second CPT + relationship<\/td>\n<td>Speaker, venue<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>A city clearly illustrates the difference. It can be a text field if it is only displayed on the event page. It becomes a taxonomy if users need to find a useful collection such as \u201cEvents in Milan.\u201d If the venue has an address, map, contact details, images, and is used by many events, a related <em>Venues<\/em> CPT makes sense.<\/p>\n<p>A practical rule: an entity with its own page and editorial lifecycle suggests a CPT; the need to aggregate and filter suggests a taxonomy; a descriptive property is a field; and an internal list is a repeater.<\/p>\n<h2>ACF or code: which approach to choose and where to register the CPT<\/h2>\n<p>Advanced Custom Fields lets you create field groups and, through its interface, post types and taxonomies as well. Code in a custom plugin provides greater control over distribution and the development lifecycle. These are not mutually exclusive options.<\/p>\n<div class=\"table-1\">\n<table style=\"width: 100%;\">\n<thead>\n<tr>\n<th>Approach<\/th>\n<th>When it is appropriate<\/th>\n<th>Benefits and limitations<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>ACF interface<\/td>\n<td>Standard projects and teams that need to manage configurations<\/td>\n<td>Fast and easy to read; requires organized configuration management<\/td>\n<\/tr>\n<tr>\n<td>Custom plugin<\/td>\n<td>Products, integrations, deployments, and custom capabilities<\/td>\n<td>Version-controlled and independent; requires development and maintenance<\/td>\n<\/tr>\n<tr>\n<td>Hybrid approach<\/td>\n<td>Professional projects already based on ACF<\/td>\n<td>Visual initial configuration, then PHP export or Local JSON in the repository<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>ACF is a good choice when fields and the content model need to be editable by the team. Repeater, Flexible Content, and Options Page are features to check based on the license and version in use. Definitions can be exported to PHP or saved as <a href=\"https:\/\/www.advancedcustomfields.com\/resources\/local-json\/\">Local JSON<\/a> in the <code>acf-json<\/code> folder, making them easier to synchronize between staging and production.<\/p>\n<p>Code-based registration is preferable when the CPT is part of a product, needs to be distributed, reviewed through code review, or maintained independently of ACF and the theme.<\/p>\n<p>The <code>functions.php<\/code> file can work, but it ties the content model to the design: when changing themes, the CPT may disappear from the admin panel. Register it in a dedicated plugin instead or, where appropriate, in a mu-plugin.<\/p>\n<p>The technical key should be short, stable, lowercase, and prefixed. A post type key can be up to 20 characters long, while a taxonomy key can be up to 32. In this example, we will use <code>acme_evento<\/code> and <code>acme_tipo_evento<\/code>, avoiding generic names that could conflict with themes or plugins. The public slug can be different: here it will be <code>eventi<\/code>. Changing the technical key requires a content migration; changing an already published slug requires 301 redirects, checks on internal links, canonicals, and sitemaps.<\/p>\n<h2>Tutorial: creating the Events CPT and taxonomy with a plugin<\/h2>\n<p>Create the <code>wp-content\/plugins\/acme-eventi<\/code> folder and add the <code>acme-eventi.php<\/code> file inside it. Then activate the plugin from the WordPress dashboard.<\/p>\n<\/div><style type=\"text\/css\" scopped=\"scopped\">.fusion-syntax-highlighter-1 > .CodeMirror, .fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-gutters {background-color:var(--awb-color1);}.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-gutters { background-color: var(--awb-color2); }.fusion-syntax-highlighter-1 > .CodeMirror .CodeMirror-linenumber { color: var(--awb-color8); }<\/style><div class=\"fusion-syntax-highlighter-container fusion-syntax-highlighter-1 fusion-syntax-highlighter-theme-light\" style=\"opacity:0;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px;border-width:1px;border-style:solid;border-color:#e0dede;\"><div class=\"syntax-highlighter-copy-code\"><span class=\"syntax-highlighter-copy-code-title\" data-id=\"fusion_syntax_highlighter_1\" style=\"font-size:14px;\">Copia negli & appunti<\/span><\/div><label for=\"fusion_syntax_highlighter_1\" class=\"screen-reader-text\">Syntax Highlighter<\/label><textarea class=\"fusion-syntax-highlighter-textarea\" id=\"fusion_syntax_highlighter_1\" data-readOnly=\"nocursor\" data-lineNumbers=\"1\" data-lineWrapping=\"\" data-theme=\"default\" data-mode=\"text\/x-sh\"><?php \/** * Plugin Name: ACME Eventi * Description: Registra il CPT Eventi e la relativa tassonomia. * Version: 1.0.0 *\/ if ( ! defined( 'ABSPATH' ) ) { exit; } function acme_register_eventi() { register_post_type( 'acme_evento', array( 'labels' => array( 'name' => 'Eventi', \n  \t\t\t\t\t\t\t\t\t\t\t'singular_name' => 'Evento', \n  \t\t\t\t\t\t\t\t\t\t\t'add_new_item' => 'Aggiungi evento', \n  \t\t\t\t\t\t\t\t\t\t\t'edit_item' => 'Modifica evento', ),\n  \t\t\t\t\t\t'public' => true, \n  \t\t\t\t\t\t'publicly_queryable' => true, \n  \t\t\t\t\t\t'exclude_from_search' => false, \n  \t\t\t\t\t\t'has_archive' => 'eventi', \n  \t\t\t\t\t\t'rewrite' => array( 'slug' => 'eventi', \n  \t\t\t\t\t\t\t\t\t\t\t'with_front' => false ), \n  \t\t\t\t\t\t'show_in_rest' => true, \n  \t\t\t\t\t\t'menu_icon' => 'dashicons-calendar-alt', \n  \t\t\t\t\t\t'supports' => array( 'title', \n  \t\t\t\t\t\t\t\t\t\t\t'editor', \n  \t\t\t\t\t\t\t\t\t\t\t'thumbnail', \n  \t\t\t\t\t\t\t\t\t\t\t'excerpt', \n  \t\t\t\t\t\t\t\t\t\t\t'revisions' ), \n  \t\t\t\t\t\t) \n  \t\t\t\t\t); \n  register_taxonomy( 'acme_tipo_evento', \n  \t\t\t\t\tarray( 'acme_evento' ), \n  \t\t\t\t\tarray( 'labels' => array( 'name' => 'Tipi di evento', \n  \t\t\t\t\t\t\t\t\t\t\t'singular_name' => 'Tipo di evento', \n  \t\t\t\t\t\t\t\t\t\t\t), \n  \t\t\t\t\t\t\t'public' => true, \n  \t\t\t\t\t\t\t'hierarchical' => true, \n  \t\t\t\t\t\t\t'show_admin_column' => true, \n  \t\t\t\t\t\t\t'show_in_rest' => true, \n  \t\t\t\t\t\t\t'rewrite' => array( 'slug' => 'tipo-evento', \n  \t\t\t\t\t\t\t\t\t\t\t\t'with_front' => false ), \n  \t\t\t\t\t\t ) \n  \t\t\t\t\t); \n} \nadd_action( 'init', 'acme_register_eventi' ); \n\nfunction acme_eventi_activate() { \n  acme_register_eventi(); \n  flush_rewrite_rules(); \n} \nregister_activation_hook( __FILE__, 'acme_eventi_activate' ); \n\nfunction acme_eventi_deactivate() { flush_rewrite_rules(); } \nregister_deactivation_hook( __FILE__, 'acme_eventi_deactivate' );<\/textarea><\/div><div class=\"fusion-text fusion-text-2\"><p>Registration takes place on <code>init<\/code>, as required by the WordPress APIs. The activation hook first registers the structures and then regenerates the rewrite rules. Do not call <code>flush_rewrite_rules()<\/code> on every request: it is an expensive operation. If you encounter a 404 during development, save the <em>Settings \u2192 Permalinks<\/em> page again.<\/p>\n<h2>Adding fields with ACF and preparing queryable content<\/h2>\n<p>In ACF, create a field group called \u201cEvent data\u201d and apply it when the post type equals <code>acme_evento<\/code>. A basic configuration may include:<\/p>\n<ul>\n<li>start and end dates with Date Picker;<\/li>\n<li>time with Time Picker;<\/li>\n<li>price with a Number field;<\/li>\n<li>registration URL with a URL field;<\/li>\n<li>speaker with Relationship or Post Object;<\/li>\n<li>schedule PDF with a File field;<\/li>\n<li>a \u201cFeatured\u201d flag with True\/False.<\/li>\n<\/ul>\n<p>With Local JSON, ACF saves definitions in the <code>acf-json<\/code> folder of the configured theme or plugin. Version these definitions, not the editorial content stored in the database. Alternatively, export field groups to PHP and include them in the project plugin.<\/p>\n<p>To retrieve upcoming events, use a format consistent with the saved value. The ACF Date Picker normally stores the database value in <code>Ymd<\/code> format; in this case, a numeric comparison is appropriate:<\/p>\n<pre><code>$eventi_futuri = new WP_Query( array(\r\n    'post_type'      =&gt; 'acme_evento',\r\n    'posts_per_page' =&gt; 12,\r\n    'meta_key'       =&gt; 'data_inizio',\r\n    'orderby'        =&gt; 'meta_value_num',\r\n    'order'          =&gt; 'ASC',\r\n    'meta_query'     =&gt; array(\r\n        array(\r\n            'key'     =&gt; 'data_inizio',\r\n            'value'   =&gt; current_time( 'Ymd' ),\r\n            'compare' =&gt; '&gt;=',\r\n            'type'    =&gt; 'NUMERIC',\r\n        ),\r\n    ),\r\n) );\r\n<\/code><\/pre>\n<p>Values in <code>wp_postmeta<\/code> are handled as strings. For dates, prices, and times, use the appropriate type in the <code>meta_query<\/code>, such as <code>DATE<\/code>, <code>DATETIME<\/code>, <code>NUMERIC<\/code>, or <code>DECIMAL<\/code>, based on the format actually stored.<\/p>\n<p>Very large Repeaters, complex Flexible Content layouts, and multiple filters on large catalogs can make both the editor and front end heavier. For high volumes, assess the data model before relying exclusively on post meta and complex queries.<\/p>\n<h2>Templates, Gutenberg, REST API, and SEO<\/h2>\n<p>In a classic theme, WordPress will look for <code>single-acme_evento.php<\/code> for an individual event page and <code>archive-acme_evento.php<\/code> for the archive. In block themes, the template hierarchy follows similar logic, but templates are block-based HTML files in the <code>\/templates<\/code> folder. Changes saved through the Site Editor may override files provided by the theme.<\/p>\n<p>The front-end template controls the public page. An editor block template, on the other hand, defines the initial structure of a new item; a template lock limits which blocks the editor can modify. These are separate tools.<\/p>\n<p><code>show_in_rest =&gt; true<\/code> enables the CPT for Gutenberg and the REST API. However, it is not enough to expose ACF fields: the \u201cShow in REST API\u201d option must also be enabled in the field group, as indicated in the <a href=\"https:\/\/www.advancedcustomfields.com\/resources\/wp-rest-api-integration\/\">ACF REST API documentation<\/a>.<\/p>\n<p>Archives and taxonomies should be published only if they genuinely help navigation or match real searches. A sitemap can communicate URLs to search engines, but it does not guarantee indexing. Public pages should be useful, reachable through crawlable links, and aligned with the principles of <a href=\"https:\/\/developers.google.com\/search\/docs\/fundamentals\/creating-helpful-content\">helpful, people-first content<\/a>. Thin or duplicate archives require a deliberate editorial decision.<\/p>\n<h2>Pre-publication checks and common issues<\/h2>\n<ul>\n<li><strong>404 on a single page or archive:<\/strong> check that the plugin is active, registration runs on <code>init<\/code>, there are no slug collisions, and permalinks have been regenerated.<\/li>\n<li><strong>Gutenberg is missing:<\/strong> check <code>show_in_rest<\/code> and the post type supports.<\/li>\n<li><strong>ACF fields are not in the REST API:<\/strong> enable \u201cShow in REST API\u201d in the field group as well as <code>show_in_rest<\/code> on the CPT.<\/li>\n<li><strong>CPT missing from the homepage:<\/strong> it is not automatically added to the main query; modify the query only when there is a genuine editorial need.<\/li>\n<li><strong>Duplicate CPT:<\/strong> check that it is not registered simultaneously by ACF, CPT UI, the theme, and a plugin.<\/li>\n<li><strong>CPT disappears after changing themes:<\/strong> move registration from the theme to a dedicated plugin.<\/li>\n<\/ul>\n<p>Before release, check keys and slugs, the single and archive templates, field types, permissions, existing URLs, and redirects. Keep Local JSON or PHP exports in the repository, test on staging, create backups, and evaluate sitemaps and indexing only for sections that deserve visibility.<\/p>\n<p>For a new project, start with the entity and its relationships, not the configuration screen. Create a few real events, verify how the team searches for and manages them, then add archives, taxonomies, and relationships only when they genuinely improve the website experience.<\/p>\n<h2>FAQ<\/h2>\n<h3>What is a Custom Post Type in WordPress?<\/h3>\n<p>A Custom Post Type is a custom content type that sits alongside posts and pages. It lets you manage entities such as events, courses, properties, or case studies with dedicated archives, taxonomies, fields, and templates.<\/p>\n<h3>When should you create a Custom Post Type?<\/h3>\n<p>It is useful when content is published repeatedly, has recurring data, requires its own page or archive, or needs to be filtered, classified, or linked to other content.<\/p>\n<h3>What is the difference between a Custom Post Type, a taxonomy, and an ACF field?<\/h3>\n<p>A Custom Post Type represents an editorial entity, a taxonomy classifies and aggregates multiple items, while an ACF field stores a specific property of a single item, such as a date, price, or URL.<\/p>\n<h3>Is it better to create a Custom Post Type with ACF or code?<\/h3>\n<p>It depends on the project. ACF makes configuration faster and easier to manage, while a custom code-based plugin provides more control, versioning, and independence from the theme. Professional projects can also use a hybrid approach.<\/p>\n<h3>Is it better to register a Custom Post Type in functions.php or in a plugin?<\/h3>\n<p>In general, a dedicated plugin or, where appropriate, a mu-plugin is preferable. Registering it in <code>functions.php<\/code> ties the Custom Post Type to the theme, and it may no longer be available after switching themes.<\/p>\n<h3>Why does a Custom Post Type return a 404 error?<\/h3>\n<p>Common causes include outdated rewrite rules, slug collisions, an inactive plugin, or registration happening at the wrong time. During development, saving the Settings \u2192 Permalinks page again may be enough.<\/p>\n<\/div><\/div><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learn when a WordPress Custom Post Type is genuinely useful and how to create CPTs, taxonomies, ACF fields, and templates with a practical events example.<\/p>\n","protected":false},"author":1,"featured_media":947,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-1031","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-and-tools"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WordPress Custom Post Types: ACF or Code?<\/title>\n<meta name=\"description\" content=\"Learn when to use WordPress Custom Post Types and how to create them with ACF or code, including taxonomies, templates, REST API and common fixes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress Custom Post Types: ACF or Code?\" \/>\n<meta property=\"og:description\" content=\"Learn when to use WordPress Custom Post Types and how to create them with ACF or code, including taxonomies, templates, REST API and common fixes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/\" \/>\n<meta property=\"og:site_name\" content=\"My Web Friend\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/mywebfriend\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-20T18:02:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-20T18:04:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mywebfriend.net\/wp-content\/uploads\/2026\/10\/Architettura-digitale-dei-contenuti-WordPress.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1536\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Enrico\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Enrico\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/\"},\"author\":{\"name\":\"Enrico\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#\\\/schema\\\/person\\\/76f8f72569d3bd0232e1876e430032e2\"},\"headline\":\"WordPress Custom Post Types: when to use them and how to create them with ACF or code\",\"datePublished\":\"2026-11-20T18:02:02+00:00\",\"dateModified\":\"2026-11-20T18:04:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/\"},\"wordCount\":2172,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/mywebfriend.net\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/Architettura-digitale-dei-contenuti-WordPress.jpg\",\"articleSection\":[\"Software &amp; Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/\",\"url\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/\",\"name\":\"WordPress Custom Post Types: ACF or Code?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/mywebfriend.net\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/Architettura-digitale-dei-contenuti-WordPress.jpg\",\"datePublished\":\"2026-11-20T18:02:02+00:00\",\"dateModified\":\"2026-11-20T18:04:53+00:00\",\"description\":\"Learn when to use WordPress Custom Post Types and how to create them with ACF or code, including taxonomies, templates, REST API and common fixes.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#primaryimage\",\"url\":\"https:\\\/\\\/mywebfriend.net\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/Architettura-digitale-dei-contenuti-WordPress.jpg\",\"contentUrl\":\"https:\\\/\\\/mywebfriend.net\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/Architettura-digitale-dei-contenuti-WordPress.jpg\",\"width\":1536,\"height\":1024,\"caption\":\"architettura digitale dei contenuti Wordpress\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/wordpress-custom-post-types-acf-code\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Custom Post Types: when to use them and how to create them with ACF or code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/\",\"name\":\"MyWebFriend\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#organization\",\"name\":\"Linktotheworld di Enrico Cecchini\",\"url\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/mywebfriend.net\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/Logo.png\",\"contentUrl\":\"https:\\\/\\\/mywebfriend.net\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/Logo.png\",\"width\":374,\"height\":80,\"caption\":\"Linktotheworld di Enrico Cecchini\"},\"image\":{\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/mywebfriend\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/#\\\/schema\\\/person\\\/76f8f72569d3bd0232e1876e430032e2\",\"name\":\"Enrico\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3eee2cadfe4f77db730fd867e283553dbb7ca707ca7553759655798d7e874092?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3eee2cadfe4f77db730fd867e283553dbb7ca707ca7553759655798d7e874092?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3eee2cadfe4f77db730fd867e283553dbb7ca707ca7553759655798d7e874092?s=96&d=mm&r=g\",\"caption\":\"Enrico\"},\"description\":\"Ciao, mi chiamo Enrico Cecchini, ho sempre avuto la passione dei computer, fin da quando ero piccolo. Ho fatto di questa passione la mia professione e dopo aver conseguito la laurea in ingegneria informatica ho iniziato a sviluppare siti web. Ho creato Mywebfriend per aiutare a risolvere dubbi e problemi che nascono utilizzando il computer.\",\"url\":\"https:\\\/\\\/mywebfriend.net\\\/en\\\/author\\\/enrico-cecchini\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress Custom Post Types: ACF or Code?","description":"Learn when to use WordPress Custom Post Types and how to create them with ACF or code, including taxonomies, templates, REST API and common fixes.","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:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/","og_locale":"en_US","og_type":"article","og_title":"WordPress Custom Post Types: ACF or Code?","og_description":"Learn when to use WordPress Custom Post Types and how to create them with ACF or code, including taxonomies, templates, REST API and common fixes.","og_url":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/","og_site_name":"My Web Friend","article_publisher":"https:\/\/www.facebook.com\/mywebfriend\/","article_published_time":"2026-11-20T18:02:02+00:00","article_modified_time":"2026-11-20T18:04:53+00:00","og_image":[{"width":1536,"height":1024,"url":"https:\/\/mywebfriend.net\/wp-content\/uploads\/2026\/10\/Architettura-digitale-dei-contenuti-WordPress.jpg","type":"image\/jpeg"}],"author":"Enrico","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Enrico","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#article","isPartOf":{"@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/"},"author":{"name":"Enrico","@id":"https:\/\/mywebfriend.net\/en\/#\/schema\/person\/76f8f72569d3bd0232e1876e430032e2"},"headline":"WordPress Custom Post Types: when to use them and how to create them with ACF or code","datePublished":"2026-11-20T18:02:02+00:00","dateModified":"2026-11-20T18:04:53+00:00","mainEntityOfPage":{"@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/"},"wordCount":2172,"commentCount":0,"publisher":{"@id":"https:\/\/mywebfriend.net\/en\/#organization"},"image":{"@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#primaryimage"},"thumbnailUrl":"https:\/\/mywebfriend.net\/wp-content\/uploads\/2026\/10\/Architettura-digitale-dei-contenuti-WordPress.jpg","articleSection":["Software &amp; Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/","url":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/","name":"WordPress Custom Post Types: ACF or Code?","isPartOf":{"@id":"https:\/\/mywebfriend.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#primaryimage"},"image":{"@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#primaryimage"},"thumbnailUrl":"https:\/\/mywebfriend.net\/wp-content\/uploads\/2026\/10\/Architettura-digitale-dei-contenuti-WordPress.jpg","datePublished":"2026-11-20T18:02:02+00:00","dateModified":"2026-11-20T18:04:53+00:00","description":"Learn when to use WordPress Custom Post Types and how to create them with ACF or code, including taxonomies, templates, REST API and common fixes.","breadcrumb":{"@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#primaryimage","url":"https:\/\/mywebfriend.net\/wp-content\/uploads\/2026\/10\/Architettura-digitale-dei-contenuti-WordPress.jpg","contentUrl":"https:\/\/mywebfriend.net\/wp-content\/uploads\/2026\/10\/Architettura-digitale-dei-contenuti-WordPress.jpg","width":1536,"height":1024,"caption":"architettura digitale dei contenuti Wordpress"},{"@type":"BreadcrumbList","@id":"https:\/\/mywebfriend.net\/en\/wordpress-custom-post-types-acf-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mywebfriend.net\/en\/home\/"},{"@type":"ListItem","position":2,"name":"WordPress Custom Post Types: when to use them and how to create them with ACF or code"}]},{"@type":"WebSite","@id":"https:\/\/mywebfriend.net\/en\/#website","url":"https:\/\/mywebfriend.net\/en\/","name":"MyWebFriend","description":"","publisher":{"@id":"https:\/\/mywebfriend.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mywebfriend.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/mywebfriend.net\/en\/#organization","name":"Linktotheworld di Enrico Cecchini","url":"https:\/\/mywebfriend.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mywebfriend.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/mywebfriend.net\/wp-content\/uploads\/2019\/11\/Logo.png","contentUrl":"https:\/\/mywebfriend.net\/wp-content\/uploads\/2019\/11\/Logo.png","width":374,"height":80,"caption":"Linktotheworld di Enrico Cecchini"},"image":{"@id":"https:\/\/mywebfriend.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/mywebfriend\/"]},{"@type":"Person","@id":"https:\/\/mywebfriend.net\/en\/#\/schema\/person\/76f8f72569d3bd0232e1876e430032e2","name":"Enrico","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3eee2cadfe4f77db730fd867e283553dbb7ca707ca7553759655798d7e874092?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3eee2cadfe4f77db730fd867e283553dbb7ca707ca7553759655798d7e874092?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3eee2cadfe4f77db730fd867e283553dbb7ca707ca7553759655798d7e874092?s=96&d=mm&r=g","caption":"Enrico"},"description":"Ciao, mi chiamo Enrico Cecchini, ho sempre avuto la passione dei computer, fin da quando ero piccolo. Ho fatto di questa passione la mia professione e dopo aver conseguito la laurea in ingegneria informatica ho iniziato a sviluppare siti web. Ho creato Mywebfriend per aiutare a risolvere dubbi e problemi che nascono utilizzando il computer.","url":"https:\/\/mywebfriend.net\/en\/author\/enrico-cecchini\/"}]}},"wpml_language":"en","wpml_trid":1103,"wpml_translations":{"it":943,"en":1031},"_links":{"self":[{"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/posts\/1031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/comments?post=1031"}],"version-history":[{"count":4,"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/posts\/1031\/revisions"}],"predecessor-version":[{"id":1236,"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/posts\/1031\/revisions\/1236"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/media\/947"}],"wp:attachment":[{"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/media?parent=1031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/categories?post=1031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mywebfriend.net\/en\/wp-json\/wp\/v2\/tags?post=1031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}