Support

Account

Home Forums Front-end Issues Use Custom URL Vars in Taxonomy Query

Unread

Use Custom URL Vars in Taxonomy Query

  • I’m stuck ::: I’m trying to use a URL variable’s value in the ACF Taxonomy Query :::

    For instance I have the following URL :

    bozo.com/listing/?location=san-francisco&type=14

    I now need to use the value “14” in the following function :::

    How can I do this ?

    // Frontend Type Taxonomy
    $type_id = $_GET('type');
    
    function ydcoza_type_acf_taxonomy( $args, $field, $post_id ) {
        global $type_id;
    
        $args['child_of'] = $type_id;
    
        // return
        return $args;
    }
    add_filter('acf/fields/taxonomy/query/key=field_5a76bfb425b99', 'ydcoza_type_acf_taxonomy', 10, 3);
Viewing 1 post (of 1 total)

The topic ‘Use Custom URL Vars in Taxonomy Query’ is closed to new replies.