Home › Forums › Backend Issues (wp-admin) › ACF load_value to Gallery Field › Reply To: ACF load_value to Gallery Field
To be honest, I’m not clear on what you’re trying to do, but hopefully correcting a couple of issues I see in your second code snippet and answering your questions there will help.
first, at the top of your function you need to return the current value if set
if (!empty($value)) {
// already has a value
return $value;
}
the question
// How to get the Slider ID of current post?
$id = 123;
$table = $wpdb->prefix . 'new_royalsliders';
$slider_data = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $table WHERE id=%d", $id), ARRAY_A );
should be something like
$id = get_field('media_gallery_slider', $post_id, false);
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.