• Resolved alexmkubik

    (@alexmkubik)


    gmw_update_post_type_post_location

    Any guidance on using with a CPT? I have a cpt called groups.

    I have a CF7 form on the frontend mapped to the fields of the CPT, including taxonomies.

    I have a custom field called “group_meeting_address” which receives an address string from the form.

    How do I modify the example to trigger with this cpt instead of the main post?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Eyal Fitoussi

    (@ninjew)

    Hello @alexmkubik,

    Assuming that you are referring to the General Usage example of this tutorial, then try the below:

    1. Replace line 56 which is:

    
    add_action( 'save_post_post', 'gmw_update_post_type_post_location' );
    

    With:

    
    add_action( 'save_post_groups', 'gmw_update_post_type_post_location' );
    

    2. Replace line 40 which is:

    
    $address = get_post_meta( $post_id, 'address', true );
    

    With

    
    $address = get_post_meta( $post_id, 'group_meeting_address', true );
    

    Then submit the form and see if the address is being recorded in the newly created post.

    I hope this helps.

    Thread Starter alexmkubik

    (@alexmkubik)

    OK, I had done those.

    I just saw that since the form submits post as a draft, it doesn’t run the script. Once I publish, the script runs perfectly.

    Thank you!

    Plugin Author Eyal Fitoussi

    (@ninjew)

    You are welcome, @alexmkubik.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Update location with CPT’ is closed to new replies.