Home › Forums › General Issues › How to get the Field Group ID from a page? › Reply To: How to get the Field Group ID from a page?
I had to do it manually.
I query the database and look for a rules for a specific post. If I found one, I grad the ID.
It works, but it’s not pretty:
//We look into the rules to see if any are applied
$rows = $wpdb->get_results(“SELECT * FROM wp_postmeta WHERE meta_key = ‘rule'”);
foreach ($rows as $row) {
$values = unserialize($row->meta_value);
if ($postid == $values[“value”]) { $numberofacffield = $row->post_id; }
}
//Here, we read the fields since $numberofacffield is the ID we are looking for.
$custom_field_keys = get_post_custom_keys($numberofacffield);
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.