Support » Plugin: Events Manager » Copy EM_Location object fields to custom fields?

  • Resolved Pete

    (@angio)


    Hi,

    I tried to create a filter using the code below

    function custom_filter() {
    
        update_post_meta($this->post_id, 'cf_location_address', $this->location_address);
        update_post_meta($this->post_id, 'cf_location_town', $this->location_town);
        update_post_meta($this->post_id, 'cf_location_state', $this->location_state);
        update_post_meta($this->post_id, 'cf_location_postcode', $this->location_postcode);
        // print_r($this);
    }
    add_filter('em_location_save','custom_filter' );

    It’s not correct, that I know but I thought it would execute my code? If I place the update_post_meta functions in to em-location.php the code work. But I need to write this as a filter.

    In my functions.php within my custom function how can I get the $this variable to print which is in the em-location.php file? I suppose from there I can write the rest of the function.

    Thanks

    http://wordpress.org/extend/plugins/events-manager/

Viewing 1 replies (of 1 total)
  • you need something like

    function custom_filter($result,$EM_location) {
     update_post_meta($EM_location->post_id, .......
    }
    add_filter('em_location_save','custom_filter',1,2 );
Viewing 1 replies (of 1 total)
  • The topic ‘Copy EM_Location object fields to custom fields?’ is closed to new replies.