Populate post categories


I want put button “Select All” to checkbox field. The problem is for Categories don’t exist. Is possible add it? I was thinking about populate categories in another field type but i can’t populate it!

For Taxonomies, i’m populating this way:

add_filter('gform_pre_render_1', 'lc_populate_member_option');
function lc_populate_member_option($form){

    $terms = get_terms( array(
        'taxonomy' => 'experiencias',
        'hide_empty' => false,
        'orderby'   =>'title',
        'order'   =>'ASC',
    ) );

    $items = array();

    foreach($terms as $term)
        $items[] = array(
           "value" => $term->slug, 
           "text" =>  $term->name

    foreach($form["fields"] as &$field)
        if($field["id"] == 35){
            $field["type"] = "Experiencias";
            $field["choices"] = $items;
    return $form;

I would recommend you to use the following example from the documentation as base for your dynamic population code: gform_pre_render - Gravity Forms Documentation

IMPORTANT: You will want to exclude the page from caching if you’re using caching plugin or server side cache.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.