Hi again –
Okay – just noting that I ended up exporting the ACF definition to PHP code, and putting it into the child theme’s functions.php file. From there, to get the suggestions that I wanted, I manually queried out the past entries from the database, and added them to the ACF definitions myself (in the “available_tags” section). Here’s some code snippets, if it helps. NOTE: I’m using the generic field name of “acf_field” in my code – you’d want to replace that with your actual ACF field name / handle in the appropriate places… and you should *not* copy / paste the ACF PHP code itself, as that will not work:
// Pull any previous "acf_field" values from the wp_postmeta table
$query_acf_field = "SELECT DISTINCT meta_value FROM " . $wpdb->prefix . "postmeta WHERE meta_key = 'acf_field' ORDER BY meta_value ASC";
$pull_acf_field = $wpdb->get_results($query_acf_field);
// declare the var and clear out any past information - just to be sure
$acf_field_values = '';
// loop through the query results, and add them to the list - each on their own line
foreach ($pull_acf_field as $by) {
$acf_field_values .= $by->meta_value."\n";
}
And you put the output from the above query in your ACF PHP definitions, like so:
// EXAMPLE ONLY - don't copy / paste this, as it won't work.
// Instead, look in your ACF PHP code, and find the entry that uses "tag-it" as the "type"
array (
'key' => 'field_abcdef1234567',
'label' => 'acf_field',
'name' => 'acf_field',
'type' => 'tag-it',
'instructions' => 'Add any acf_field information you wish to appear publicly',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'available_tags' => $acf_field_values,
),
Note that you should be able to enforce no results for suggestions by simply having:
‘available_tags’ => ”,
HTH,
-twykr
-
This reply was modified 7 years, 10 months ago by twykr.
-
This reply was modified 7 years, 10 months ago by twykr.
-
This reply was modified 7 years, 10 months ago by twykr.
-
This reply was modified 7 years, 10 months ago by twykr.