Since: 3.1.4
File: includes/wp-geo.php
Param: $content HTML output
Param: $post_id Post ID

The wpgeo_edit_post_map_fields filter allows you to insert extra fields in the post edit screen below the main map editing fields.

Add your HTML to the $content parameter. The HTML should be a table row with 2 columns.

You  will need to run a function when the post is saved to save your post data using the update_post_meta() function. You can use the WordPress save_post action hook to do this.

Example

// My edit post fields
function my_wpgeo_edit_post_map_fields( $content, $post_id ) {
	// Get your field's saved value
	$my_new_field_value = get_post_meta( $post_id, 'my_new_field_key', true );
	// Write the form fields
	$content .= '<tr>
			<th scope="row">My New Field</th>
			<td><input name="my_new_field_id" type="text" id="my_new_field_id" value="' . $my_new_field_value . '" /></td>
		</tr>';
	return $content;
}
add_filter( 'wpgeo_edit_post_map_fields', 'my_wpgeo_edit_post_map_fields' );

Leave a Reply