{"id":6646,"date":"2022-10-01T10:20:00","date_gmt":"2022-10-01T14:20:00","guid":{"rendered":"https:\/\/themespress.ca\/?p=6646"},"modified":"2022-10-09T08:08:40","modified_gmt":"2022-10-09T12:08:40","slug":"dynamically-completing-selection-fields","status":"publish","type":"post","link":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/","title":{"rendered":"Dynamically Completing Selection Fields"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-8\"><div class=\"vc_column-inner vc_custom_1664629052139\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>With this tutorial, we will show you how to <strong>complete fields dynamically<\/strong> for <strong>custom post types<\/strong>.<\/p>\n<p>For this we&#8217;ll need to use the <a href=\"https:\/\/www.advancedcustomfields.com\/\" target=\"_blank\" rel=\"noopener\"><strong>ACF: Advanced Custom Fields<\/strong><\/a> plugin.<\/p>\n<p>This popular extension allows users to create custom fields for posts, pages and much more. <\/p>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><div class=\"wpb_column vc_column_container vc_col-sm-4\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"225\" height=\"225\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Advanced-Custom-Fields.png\" class=\"vc_single_image-img attachment-full\" alt=\"Advanced Custom Fields - Extension WordPress\" title=\"Advanced Custom Fields\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Advanced-Custom-Fields.png 225w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Advanced-Custom-Fields-100x100.png 100w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Advanced-Custom-Fields-150x150.png 150w\" sizes=\"(max-width: 225px) 100vw, 225px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n<\/div><\/div><\/div><\/div><div class=\"vc_row wpb_row vc_row-fluid vc_custom_1664628524526\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner vc_custom_1664629058348\"><div class=\"wpb_wrapper\"><h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading vc_custom_1664629018479\" >Create group fields with ACF<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>We can create group fields and add the desired fields within these groups. Certain fields are available in the <a href=\"https:\/\/en-ca.wordpress.org\/plugins\/advanced-custom-fields\/\" target=\"_blank\" rel=\"noopener\"><strong>free version<\/strong><\/a>, and the <a href=\"https:\/\/www.advancedcustomfields.com\/pro\/\" target=\"_blank\" rel=\"noopener\"><strong>Pro version <\/strong><\/a>.<\/p>\n<p>For example, the <strong>Repeater field<\/strong> is available in the Pro version.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading vc_custom_1664629358971\" >List of fields avalable in ACF<\/h2>\n\t<div class=\"wpb_text_column wpb_content_element vc_custom_1664633699208\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Here&#8217;s the list of <a href=\"https:\/\/www.advancedcustomfields.com\/resources\/\" target=\"_blank\" rel=\"noopener\"><strong>custom fields<\/strong><\/a> available in the free and Pro versions.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div class=\"vc_row wpb_row vc_inner vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-4\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading title-acf vc_custom_1664631478382\" >Basic<\/h3>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<ul>\n<li>Text<\/li>\n<li>Text fields<\/li>\n<li>Numbers<\/li>\n<li>Set<\/li>\n<li>Email<\/li>\n<li>URL<\/li>\n<li>Password<\/li>\n<\/ul>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><div class=\"wpb_column vc_column_container vc_col-sm-4\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading title-acf vc_custom_1664631483071\" >Content<\/h3>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<ul>\n<li>Image<\/li>\n<li>Files<\/li>\n<li>Wysiwyg editor<\/li>\n<li>oEmbed content<\/li>\n<li>Gallery<\/li>\n<\/ul>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><div class=\"wpb_column vc_column_container vc_col-sm-4\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading title-acf vc_custom_1664631489418\" >Choices<\/h3>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<ul>\n<li>Drop down list<\/li>\n<li>Checkboxes<\/li>\n<li>Radio button<\/li>\n<li>Button group<\/li>\n<li>True\/False<\/li>\n<\/ul>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div><div class=\"vc_row wpb_row vc_inner vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-4\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading title-acf vc_custom_1664631494656\" >Relational<\/h3>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<ul>\n<li>Link<\/li>\n<li>Objet de la publication<\/li>\n<li>Hyperlink<\/li>\n<li>Relation<\/li>\n<li>Taxonomy<\/li>\n<li>Account<\/li>\n<\/ul>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><div class=\"wpb_column vc_column_container vc_col-sm-4\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading title-acf vc_custom_1664631573377\" >JQuery<\/h3>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<ul>\n<li>Google Maps<\/li>\n<li>Date selector<\/li>\n<li>Date &amp; time selector<\/li>\n<li>Time selector<\/li>\n<li>Color selector<\/li>\n<\/ul>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><div class=\"wpb_column vc_column_container vc_col-sm-4\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading title-acf vc_custom_1664631578069\" >Layout<\/h3>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<ul>\n<li>Message<\/li>\n<li>Accordion<\/li>\n<li>Tab<\/li>\n<li>Group<\/li>\n<li>Repeater<\/li>\n<li>Flexible content<\/li>\n<li>Clone<\/li>\n<\/ul>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div><\/div><\/div><\/div><\/div><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>For our tutorial, we will create a new group and add a custom selectable field.<\/p>\n<p>This group of fields can be displayed wherever you need it.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"1440\" height=\"329\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Reglages-ACF-pour-un-groupe-de-champs-personnalises.png\" class=\"vc_single_image-img attachment-full\" alt=\"R\u00e9glages ACF pour un groupe de champs personnalis\u00e9s\" title=\"R\u00e9glages ACF pour un groupe de champs personnalis\u00e9s\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Reglages-ACF-pour-un-groupe-de-champs-personnalises.png 1440w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Reglages-ACF-pour-un-groupe-de-champs-personnalises-600x137.png 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Reglages-ACF-pour-un-groupe-de-champs-personnalises-300x69.png 300w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Reglages-ACF-pour-un-groupe-de-champs-personnalises-1024x234.png 1024w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Reglages-ACF-pour-un-groupe-de-champs-personnalises-768x175.png 768w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Reglages-ACF-pour-un-groupe-de-champs-personnalises-1320x302.png 1320w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Furthermore, within this field, you can add custom values or display post results found within your dynamic selection field.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading vc_custom_1664633898959\" >Display a selection of posts with ACF<\/h3>\n\t<div  class=\"wpb_single_image wpb_content_element vc_align_left wpb_content_element\">\n\t\t\n\t\t<figure class=\"wpb_wrapper vc_figure\">\n\t\t\t<div class=\"vc_single_image-wrapper   vc_box_border_grey\"><img decoding=\"async\" width=\"720\" height=\"284\" src=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Afficher-un-resultat-darticles-dans-un-champ-selection-ACF.png\" class=\"vc_single_image-img attachment-full\" alt=\"Afficher un r\u00e9sultat d&#039;articles dans un champ s\u00e9lection - ACF\" title=\"Afficher un r\u00e9sultat d&#039;articles dans un champ s\u00e9lection - ACF\" srcset=\"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Afficher-un-resultat-darticles-dans-un-champ-selection-ACF.png 720w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Afficher-un-resultat-darticles-dans-un-champ-selection-ACF-600x237.png 600w, https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Afficher-un-resultat-darticles-dans-un-champ-selection-ACF-300x118.png 300w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/div>\n\t\t<\/figure>\n\t<\/div>\n\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>First we need to use a <a href=\"https:\/\/themespress.ca\/creer-un-shortcode-query-post-wordpress\/\" target=\"_blank\" rel=\"noopener\"><strong>WP Query<\/strong><\/a> displayed with a <a href=\"https:\/\/www.advancedcustomfields.com\/resources\/acf-load_field\/\" target=\"_blank\" rel=\"noopener\"><strong>acf\/load_field\/<\/strong><\/a>filter.<\/p>\n<p>We will also use an argument called <strong>name<\/strong> which will serve as the <strong>name of the ACF custom dynamic field<\/strong> that you have created: acf\/load_field\/name=<strong>test<\/strong>.<\/p>\n<p><strong>Replace it with the name of your custom ACF field<\/strong>.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\"><div id=\"ts-enlighterjs-container-1655522\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-1655522\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">add_filter(&#039;acf\/load_field\/name=test&#039;, &#039;ThemespresspopulateActivites&#039;);\nfunction ThemespresspopulateActivites($field)\n{\n    $field[&#039;choices&#039;] = array();\n    wp_reset_query();\n    $query = new WP_Query(array(\n        &#039;post_type&#039; =&gt; &#039;activites&#039;,\n        &#039;order&#039; =&gt; &#039;ASC&#039;,\n        &#039;orderby&#039; =&gt; &#039;title&#039;,\n        &#039;posts_per_page&#039; =&gt; -1,\n    ));\n    $field[&#039;choices&#039;] = array();\n    foreach ($query-&gt;posts as $room_id =&gt; $matched_room) {\n        $choices[$matched_room-&gt;ID] = $matched_room-&gt;post_title;\n    }\n    if (is_array($choices)) {\n        foreach ($choices as $key =&gt; $choice) {\n            $field[&#039;choices&#039;][$key] = $choice;\n        }\n    }\n    wp_reset_query();\n    return $field;\n}<\/pre><\/div><h3 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading vc_custom_1664631733340\" >Display a selection of result within an ACF selection field for Multisite<\/h3>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Let&#8217;s take a WP Query from a multisite website, we will use the <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/switch_to_blog\/\" target=\"_blank\" rel=\"noopener\"><strong>switch_to_blog<\/strong><\/a> function.<\/p>\n<p>In our query, we will fetch the website&#8217;s ID found within the multisite. (<strong><span class=\"kw1\">switch<\/span><span class=\"\">_to_blog<\/span><span class=\"br0\">(<\/span><span class=\"nu0\">2<\/span><span class=\"br0\">)<\/span><\/strong>)<\/p>\n<p>It will then display inside our custom field all posts with an ID 2 and sorted by ascending title.<\/p>\n<p>Finally replace the name of the field with yours: (acf\/load_field\/name=<strong>test<\/strong>)<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-3683962\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-3683962\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">add_filter(&#039;acf\/load_field\/name=test&#039;, &#039;ThemespresspopulateActivitesMultisite&#039;);\nfunction ThemespresspopulateActivitesMultisite($field)\n{\n $field[&#039;choices&#039;] = array();\n wp_reset_query();\n \n switch_to_blog(2);\n $querytwo = new WP_Query(array(\n  &#039;post_type&#039; =&gt; &#039;post&#039;,\n  &#039;posts_per_page&#039; =&gt; -1,\n  &#039;order&#039; =&gt; &#039;ASC&#039;,\n  &#039;orderby&#039; =&gt; &#039;title&#039;,\n    ));\n    $field[&#039;choices&#039;] = array();\n    foreach ($querytwo-&gt;posts as $room_id =&gt; $matched_room) {\n        $choices[$matched_room-&gt;ID] = $matched_room-&gt;post_title;\n    }\n    if (is_array($choices)) {\n        foreach ($choices as $key =&gt; $choice) {\n            $field[&#039;choices&#039;][$key] = $choice;\n        }\n    }\n    restore_current_blog();\n    return $field;\n}<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p><strong>ACF &#8211; Advanced Custom Fields<\/strong> is an efficient plugin that will <strong>diplays your data<\/strong> related to posts, pages, post types, etc&#8230;<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div>\n<div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>If we don&#8217;t want to add a user field from ACF, we can create a selection field and <strong> create a query to display users with a specfic role<\/strong>.<\/p>\n<p>You can change the role in the example and why not add additional roles in the <strong>author, subscriber, editor, contributor<\/strong> array.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-8636233\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-8636233\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"standard\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">add_filter(&#039;acf\/load_field\/name=partenaire&#039;, &#039;themepresspopulateUserGroups&#039;);\nfunction themepresspopulateUserGroups( $field ){\n\/\/ reset choices\n$field[&#039;choices&#039;] = array();\n$users = get_users(array( &#039;role__in&#039; =&gt; array( &#039;partenaire&#039; ) ) );\nforeach ($users as $user) {\n$field[&#039;choices&#039;][ $user-&gt;ID ] = $user-&gt;display_name;\n}\nreturn $field;\n}<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Finally, we need to change the name of the field: <strong>acf\/load_field\/name=partenaire<\/strong><\/p>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>In conclusion, <strong>ACF &#8211; Advanced Custom Fields<\/strong> is a very useful plugin that will let you display <strong>data<\/strong> from posts, post types, pages, etc&#8230;<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<\/div><\/div><\/div><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"With this tutorial, we will show you how to complete fields dynamically for custom post types. For this we'll need to use the ACF: Advanced Custom Fields plugin. This popular<div class=\"read-more\"><a class=\"btn button-secondary\" href=\"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/\">Read More<\/a><\/div>","protected":false},"author":81,"featured_media":6564,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[283],"tags":[],"class_list":["post-6646","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Daniel\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Themespress - Des tutoriels et ressources WordPress\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Dynamically Completing Selection Fields - Themespress\" \/>\n\t\t<meta property=\"og:description\" content=\"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2022-10-01T14:20:00-04:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-10-09T12:08:40-04:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Dynamically Completing Selection Fields - Themespress\" \/>\n\t\t<meta name=\"twitter:description\" content=\"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#blogposting\",\"name\":\"Dynamically Completing Selection Fields - Themespress\",\"headline\":\"Dynamically Completing Selection Fields\",\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/Remplir-dynamiquement-les-choix-de-selection-ACF.jpg\",\"width\":1544,\"height\":500},\"datePublished\":\"2022-10-01T10:20:00-04:00\",\"dateModified\":\"2022-10-09T08:08:40-04:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#webpage\"},\"articleSection\":\"Tutorials, Optional\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#listItem\",\"name\":\"Dynamically Completing Selection Fields\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"name\":\"Accueil\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#listItem\",\"position\":3,\"name\":\"Dynamically Completing Selection Fields\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/\",\"name\":\"Daniel\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Daniel\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#webpage\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/\",\"name\":\"Dynamically Completing Selection Fields - Themespress\",\"description\":\"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/Remplir-dynamiquement-les-choix-de-selection-ACF.jpg\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#mainImage\",\"width\":1544,\"height\":500},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/dynamically-completing-selection-fields\\\/#mainImage\"},\"datePublished\":\"2022-10-01T10:20:00-04:00\",\"dateModified\":\"2022-10-09T08:08:40-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Dynamically Completing Selection Fields - Themespress","description":"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin","canonical_url":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#blogposting","name":"Dynamically Completing Selection Fields - Themespress","headline":"Dynamically Completing Selection Fields","author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Remplir-dynamiquement-les-choix-de-selection-ACF.jpg","width":1544,"height":500},"datePublished":"2022-10-01T10:20:00-04:00","dateModified":"2022-10-09T08:08:40-04:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#webpage"},"isPartOf":{"@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#webpage"},"articleSection":"Tutorials, Optional"},{"@type":"BreadcrumbList","@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","position":1,"name":"Accueil","item":"https:\/\/themespress.ca\/en\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","position":2,"name":"Tutorials","item":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#listItem","name":"Dynamically Completing Selection Fields"},"previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","name":"Accueil"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#listItem","position":3,"name":"Dynamically Completing Selection Fields","previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}}]},{"@type":"Organization","@id":"https:\/\/themespress.ca\/en\/#organization","name":"Themespress","description":"Des tutoriels et ressources WordPress","url":"https:\/\/themespress.ca\/en\/"},{"@type":"Person","@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author","url":"https:\/\/themespress.ca\/en\/author\/daniel\/","name":"Daniel","image":{"@type":"ImageObject","@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g","width":96,"height":96,"caption":"Daniel"}},{"@type":"WebPage","@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#webpage","url":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/","name":"Dynamically Completing Selection Fields - Themespress","description":"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/themespress.ca\/en\/#website"},"breadcrumb":{"@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#breadcrumblist"},"author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"creator":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2022\/10\/Remplir-dynamiquement-les-choix-de-selection-ACF.jpg","@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#mainImage","width":1544,"height":500},"primaryImageOfPage":{"@id":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/#mainImage"},"datePublished":"2022-10-01T10:20:00-04:00","dateModified":"2022-10-09T08:08:40-04:00"},{"@type":"WebSite","@id":"https:\/\/themespress.ca\/en\/#website","url":"https:\/\/themespress.ca\/en\/","name":"Themespress","description":"Des tutoriels et ressources WordPress","inLanguage":"en-US","publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"}}]},"og:locale":"en_US","og:site_name":"Themespress - Des tutoriels et ressources WordPress","og:type":"article","og:title":"Dynamically Completing Selection Fields - Themespress","og:description":"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin","og:url":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/","article:published_time":"2022-10-01T14:20:00-04:00","article:modified_time":"2022-10-09T12:08:40-04:00","twitter:card":"summary","twitter:title":"Dynamically Completing Selection Fields - Themespress","twitter:description":"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin"},"aioseo_meta_data":{"post_id":"6646","title":null,"description":"With this tutorial, we will show you how to dynamically complete fields for Post types with the ACF - Advanced Custom Fields plugin","keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2022-10-01 16:54:00","updated":"2025-06-08 02:26:06","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/\" title=\"Accueil\">Accueil<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/categorie\/tutorials\/\" title=\"Tutorials\">Tutorials<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDynamically Completing Selection Fields\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Accueil","link":"https:\/\/themespress.ca\/en\/"},{"label":"Tutorials","link":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/"},{"label":"Dynamically Completing Selection Fields","link":"https:\/\/themespress.ca\/en\/dynamically-completing-selection-fields\/"}],"_links":{"self":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/comments?post=6646"}],"version-history":[{"count":0,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6646\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media\/6564"}],"wp:attachment":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media?parent=6646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/categories?post=6646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/tags?post=6646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}