Support

Account

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);