Function Reference: geodir_clear_map_cache_on_save

Summary

Clear the map cache on post save.

Parameters

$post
(object) (required) WordPress Post object.

Default: None
$post_id
(int) (required) The post ID.

Default: None

Change Log

Since: 1.6.22

Source File

geodir_clear_map_cache_on_save() is located in geodirectory-functions/post_functions.php [Line: 3254]

Source Code

function geodir_clear_map_cache_on_save($post_id, $post) {

    if(!get_option('geodir_enable_map_cache')){
        return;
    }

    if ( isset( $post->post_type ) && ( $post->post_type == 'nav_menu_item' || $post->post_type == 'page' || $post->post_type == 'post' ) ) {
        return;
    }

    $geodir_posttypes = geodir_get_posttypes();

    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
        return;
    }

    if ( ! wp_is_post_revision( $post_id ) && isset( $post->post_type ) && in_array( $post->post_type, $geodir_posttypes ) ) {
        geodir_delete_map_cache();
    }

}