WordPress.org

Ready to get started?Download WordPress

Forums

update_post_meta problem. Don`t work with save_post action (1 post)

  1. hubet
    Member
    Posted 2 years ago #

    Ive got a problem.
    My code isn`t work inside functions.php

    add_action( 'save_post', 'createupdate_coords' );
    function createupdate_coords($post_id = false, $post = false) {
    	if ( !wp_is_post_revision( $post_id ) ) {
    		$item_adress = get_post_meta($post_id, 'item_adress', true);
    		if ($item_adress) {
    			$lat_long_coords = getLatLong($item_adress);
    			$lng = $lat_long_coords['long'];
    			$lat = $lat_long_coords['lat'];
    			update_post_meta($post_id, "item_google_lng", "$lng" );
    			update_post_meta($post_id, "item_google_lat", "$lat" );
    		}
    	}
    }

    "update_post_meta" function do nothing. Can somebody help me?

Topic Closed

This topic has been closed to new replies.

About this Topic