Forums Forums Search & Filter Pro Dynamically update Results URL

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #219188

    I realised that the results_url is simply a piece of post meta, meaning I could just:

    Grab the form ID
    Provide the meta key to update
    Build a new url base

    if ( $sfid == 29 ) {

    // Dynamically update the search-and-filter results url.
    $meta_key = ‘_search-filter-results-url’;
    $results_url = home_url() . ‘/’ . ‘shop/’ . $store_user->data->user_nicename;

    update_post_meta( $sfid, $meta_key, $results_url );
    }

    This works great, however just thinking if it’s suitable. If 10 people load a different shop url all at once, that post meta is going to rapidly change.

    Anyway just providing my solution so far and open to thoughts ideas if needed.

    Trevor
    #219226
    Anonymous
    #288374

    Provided by Stefan
    In case someone else runs into this problem, this works to add the form to multiple pages:

    function my_set_sf_resultsURL( $url, $sfid) {
    $url = get_permalink();
    return $url;

    }
    add_filter( ‘sf_results_url’, ‘my_set_sf_resultsURL’, 10, 2 );

Viewing 3 posts - 1 through 3 (of 3 total)