Support » Plugin: GEO my WordPress » Possible to set the default 'starting address' on the fly?

  • Resolved PinkishHue


    Any idea how I could set the ‘starting address’ (that we can input when setting up a form) on the fly? Possibly using the post title (the_title) (or any piece of post meta data if not title).

    I would like (for example) a list of posts with locations within 20 miles to be automatically listed on page load, which can be done using the default ‘starting address’.

    Thanks for any advice anyone can give.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I wonder if this post on can help?:

    I have tried editing the code to suit my needs but I am missing something (or a lot of things!)

    (I’ve been testing this by adding a post code by hand (replaced with *MYDATA* below for privacy) )

    I’ve tested both:




    so have left both in the code below:

    function gmw_formload( $gmw ) {
    if ( isset( $gmw->form['in_widget'] ) )
    $mypostcode = "*MYDATA*";
    //will control only form with ID 1
    if ( $gmw->form['ID'] == 1 ) {
    //set post type
    $gmw->form['search_form']['post_types'] = array('post');
    $gmw->form['search_form']['address_filter']['title'] = $mypostcode;
    $gmw->form['page_load_results']['address_filter'] = $mypostcode;
    add_filter( 'gmw_main_shortcode_custom_function',  'gmw_formload', 99 );
    Plugin Author Eyal Fitoussi


    Hello PinkishHue,
    You were in the right direction but you were not using the correct hook. Try the script below ( in the functions.php of your theme ):

    function gmw_formload( $gmw ) {
    	if ( $gmw['ID'] == 1 && $gmw['page_load_results_trigger'] == 1 ) {
    		$gmw['page_load_results']['address_filter'] = $mypostcode;
    	return $gmw;
    add_filter( "gmw_pt_default_form_values" , 'gmw_formload', 99 );

    (Delayed reply from me)

    This worked perfectly! Thank you 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Possible to set the default 'starting address' on the fly?’ is closed to new replies.