Create a custom taxonomy that will be used to create and filter markers in a Google Map

Here’s a fully working example to get you started.

Register the “marker” taxonomy

register_taxonomy( 'marker',
    'post',
    array(
        'hierarchical'          => false,
        'update_count_callback' => '_update_post_term_count',
        'label'                 => __( 'Markers', 'textdomain' ),
        'labels' => array(
                'name'              => __( 'Markers', 'textdomain' ),
                'singular_name'     => __( 'Marker', 'textdomain' ),
                'menu_name'         => _x( 'Markers', 'Admin menu name', 'textdomain' ),
                'search_items'      => __( 'Search Markers', 'textdomain' ),
                'all_items'         => __( 'All Markers', 'textdomain' ),
                'parent_item'       => __( 'Parent Marker', 'textdomain' ),
                'parent_item_colon' => __( 'Parent Marker:', 'textdomain' ),
                'edit_item'         => __( 'Edit Marker', 'textdomain' ),
                'update_item'       => __( 'Update Marker', 'textdomain' ),
                'add_new_item'      => __( 'Add New Marker', 'textdomain' ),
                'new_item_name'     => __( 'New Marker Name', 'textdomain' )
            ),
        'rewrite'               => false,
    )
);

Now we need to add the hooks to add/save the fields we need for this taxonomy

add_action( 'marker_add_form_fields',   'marker_add_fields', 10, 2 );
add_action( 'marker_edit_form_fields',  'marker_edit_fields', 10, 2 );
add_action( 'created_marker',           'save_marker_meta', 10, 2 );
add_action( 'edited_marker',            'save_marker_meta', 10, 2);

This function adds the fields to add new taxonomy screen

function marker_add_fields() {
    ?>
    <div class="form-field">
        <label for="latitude"><?php _e( 'Latitude' ); ?></label>
        <input type="text" name="latitude" id="latitude" value="">
    </div>

    <div class="form-field">
        <label for="longitude"><?php _e( 'Longitude' ); ?></label>
        <input type="text" name="longitude" id="longitude" value="">
    </div>
    <?php
}

This function add the fields to the edit screen of taxonomy

function marker_edit_fields( $term, $taxonomy ) {
    $latitude   = get_term_meta( $term->term_id, 'latitude', true );
    $longitude  = get_term_meta( $term->term_id, 'longitude', true );
    ?>
    <tr class="form-field">
        <th scope="row" valign="top"><label for="latitude"><?php _e( 'Latitude' ); ?></label></th>
        <td>
            <input type="text" name="latitude" id="latitude" value="<?php echo $latitude; ?>">
        </td>
    </tr>
    <tr class="form-field">
        <th scope="row" valign="top"><label for="longitude"><?php _e( 'Longitude' ); ?></label></th>
        <td>
            <input type="text" name="longitude" id="longitude" value="<?php echo $longitude; ?>">
        </td>
    </tr>
    <?php
}

Finally, this function saves the custom field values for our new taxonomy

function save_marker_meta( $term_id, $tt_id ){
    if( isset( $_POST['latitude'] ) && '' !== $_POST['latitude'] ){
        update_term_meta( $term_id, 'latitude', $_POST['latitude'] );
    }
    if( isset( $_POST['longitude'] ) && '' !== $_POST['longitude'] ){
        update_term_meta( $term_id, 'longitude', $_POST['longitude'] );
    }
}