@nathanaelphilip @hube2 Thanks guys for a wonderful answer. I spoke to representatives of this website you mentioned: https://www.intercom.com/ unfortunately they said they cant help out with what I need. Is there any other portal you guys can recommend?
Also I came across this plugin: https://wordpress.org/plugins/private-messages-for-wordpress/ it creates another table to handle messages. Is this a better option to have different table?
OK I solved it by updating select field using value directly instead of using as array.
$field_key = "field_5a70533ef099f";
$value = "req-pending";
update_field( $field_key, $value, $post );
Now it works fine.
@nathanaelphilip I think you are right but still its baffling how it changes on second time the post is saved.
Hi i managed to create the single array:
$addmore_deadline_cat_fees = array();
if (have_rows('add_more_deadlines')):
while (have_rows('add_more_deadlines')) : the_row();
$array = array();
if (have_rows('categories_and_fees')):
while (have_rows('categories_and_fees')) : the_row();
$array_val = get_sub_field('fee');
array_push($array,$array_val);
endwhile;endif;
$addmore_deadline_cat_fees = array_merge($addmore_deadline_cat_fees, $array);
endwhile;endif;
print_r($addmore_deadline_cat_fees);
The sub field is just a text field which is a repeater within a repeater.
Hi, I have tried this:
$value = array();
// later
$value[] = get_sub_field('fee');
print_r($value);
but its still giving me this:
Array ( [0] => 2500 ) Array ( [0] => 3000 ) Array ( [0] => 3500 ) Array ( [0] => 4000 )
I did something like this to populate a select field.
add_filter('acf/load_field/key=field_59969e19e1e31', 'my_acf_load_field');
function my_acf_load_field( $field ){
$field['choices'] = array();
$field['choices'][''] = '';
$titles = array();
$args = array(
'post_type' => array('some_post_type'),
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'title',
'order' => 'ASC',
);
$clients = get_posts( $args );
foreach ( $clients as $client ) {
$choices[] = $client->ID;
$titles[] = $client->post_title;
}
if( is_array($choices) ){
foreach (array_combine($choices, $titles) as $choice => $title) {
$field['choices'][ $choice ] = $title;
}
}
return $field;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.