Forum: F.A.Q

This forum is closed for new topics. However, you can still search for a solution in the old topics. For technical support and general questions related to GEO my WP plugin and its core add-ons please use the support forum.

Add location field to custom post that users add on the front end?

Forums F.A.Q Add location field to custom post that users add on the front end?

Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
  • #33554

    Take a look at this post. It will show you how to add locations to GEO my WP with Formidable Pro.
    I am not sure about the lat/lng fields with Formidable pro yet but I will take a look at it later.

    You will need to use a certain plugin or theme that posts from the front end. IF you do let me know which one.

    Tom Poon

    Cheers Eyal for looking into it!

    For the lat/long, is it possible to change the “address” field with the shortcodes for the lat/long?

    For example this line;

    ‘address’ => $_POST[‘item_meta’][102],[103]

    Because if you type in lat,long for an address, it still takes you to the right place…

    It’s also possible to just combine the lat/long fields into 1 hidden field in formidable pro.

    Anyway I tried it with just the single address field, but I can’t seem to get it working? How do I verify that something has been added to Geo My WP’s database? I’ve just been trying to search it with the geo my wp search form
    Maybe I’m missing a step… all I did was paste that code into my functions, edited the formidable field and then made a new post, is there something I’m missing?



    Hey Tom,
    I haven’t tried using lat/lng instead of an address but it might work if you use “latitude,longitude” instead of the address field.

    To check if the the script is working you first need to go to the admin dashboard->GEO my WP->Settings -> Post Types tab. in the Post Types feature make sure that the checkbox of the post type that you are using is checked.
    Then after creating a new post using Formidable Pro plugin go to the “Edit post” page and see if the location data is in the “GWM Location” section.

    Tom Poon

    Wohoo finally got it sorted, been faffing about with all sorts of trial and error until I got something working with lat/long 😀
    I found out the initial reason it wasn’t working for me was because the form id was wrong, doh 🙁 But after that, I tried to get long/lat to work…

    Here’s how I did it (for others wanting to do the same):

    1) Install Formidable Geocoder;

    Formidable geocoder

    2) Create a hidden field in the form that will use that geocoder, this will be used to combine the lat/long into 1 field

    3) Add this action to your functions.php;

    4) Do the stuff on this post;

    And that’s all 🙂 Thanks so much Eyal, time to buy the Geo My WP global mashup addon! This was literally the only thing I was waiting for to get my site working how I want it to, I really didn’t wanna buy gravity forms because I’m so happy with formidable pro!

    Edit: Oh no, it’s *slightly” off… the inputted lat/long is offset a bit, not enough to be in the completely wrong place, but if I input;
    53.838994,-2.189672, it appears correctly on the “type an address to autocomplete” field but in the geo My WP lat/long fields it says
    53.839840,-2.189690 …

    I think it’s doing that because it’s trying to get the closest address with a door number, but I don’t want to do that 🙁 The things I’m marking on my maps are parks and fields so it’d be best if it didn’t automatically look for the closest address. Can this behaviour be changed?

    Tom Poon

    The edit button has disappeared on my previous post… I guess I can’t edit a post twice?

    Anyway, another problem I just discovered.
    When I edit a post created by formidable to change the location, it doesn’t get updated. Is there a way to modify your action to include editing a post instead of just working for new posts?

    Alvin Bond

    1) Use a front-end post submission plugin ( there are free plugins for that ) to create posts from the from-end. When you do so I can provide you with a function that will save the address entered when submitting a post into GEO my WP tables.

    Hello Eyal,

    Thank you for creating such a great plugin.

    I am using WP User Frontend,, to let users create a custom post type in the front end.

    Can you kindly post the function necessary to update the location field(s) for the GWP field in the database? My front end form has an address field with a unique ID.

    I tried your function here – – but it did not work, I’m assuming the field names don’t line up since it’s for Formidable Pro.

    Thank you so much,

    Alvin Bond

    Actually I believe I figured it out – below is the code that worked in case somebody needs it in the future:

    Is there anything wrong with the above code? It seems to work fine but just want to be sure. Thanks!


    Thank you for the code. Indeed it is working but was generating warnings ( you would see with debug on ).
    I updated and posted the code here. It should work when creating new posts and when updating existing posts.

    add the line of code:

    to the end of the script. This is the hook to be used when updating a post.

    Let me know if it works.

    Tom Poon

    That’s brilliant Eyal! Just tested and everything is working fine now, and I found out how to prevent the exact position of the marker moving away from my lat/long data to the nearest house address/point of interest.

    Simply add



    I am glad it is working and thanks for the tips Tom.
    I will alter add the lat/lng use with Formidable Pro to the script I wrote.

    Alvin Bond

    Hi Eyal,

    Thank you so much, your updated code worked much better!

    If I am seeking customization work from you regarding extending the features of this plug-in, how do I contact you, and what is your rate?



    Hello, thanks so much for sharing this code. I wanted to add information on how to use this for bbpress topics, which I finally have working after much trial and error!

    Change instances of post to topic (e.g. post_id = topic_id) and instead of the wpuf action at the end, change to:

    add_action(‘bbp_new_topic’, ‘gmw_update_location_via_wpuf’, 10, 1 );
    add_action(‘bbp_edit_topic’, ‘gmw_update_location_via_wpuf’, 10, 1 );

    (and if you want to do it right, change all other instances of wpuf to something more relevant to your needs, but that’s not too important)


    Hi, the function for wpuf pro doesn’t works anymore, the hooks have changed and i think something else but i don’t know what



    I am fighting like hell to get this working with all the latest Geo My WP and WP User Frontend Pro plugins.

    Anyone could help me to get my custom post type “services” to work? I need:
    01. The correct way to make it work with the “Custom Fields: Address Field” in WPUF Pro;
    02. The correct code to put inside my theme’s functions.php file.

    Oh please, help me someone!

Viewing 14 posts - 16 through 29 (of 29 total)

The topic ‘Add location field to custom post that users add on the front end?’ is closed to new replies.