wpseo_invalidate_sitemap_cache_on_save_post

Invalidate the XML sitemap cache for a post type when publishing or updating a post.

Description

wpseo_invalidate_sitemap_cache_on_save_post( (int) $post_id ); 

Parameters (1)

0. $post_id (int)
Post ID to determine post type for invalidation.

Usage

  1. if ( !function_exists( 'wpseo_invalidate_sitemap_cache_on_save_post' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'yoast-seo/inc/wpseo-functions-deprecated.php'; 
  3.  
  4. // Post ID to determine post type for invalidation. 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpseo_invalidate_sitemap_cache_on_save_post($post_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc/wpseo-functions-deprecated.php  
  1. function wpseo_invalidate_sitemap_cache_on_save_post( $post_id ) { 
  2. _deprecated_function( __FUNCTION__, 'WPSEO 3.2.0', 'WPSEO_Sitemaps_Cache::invalidate_post()' ); 
  3.  
  4. WPSEO_Sitemaps_Cache::invalidate_post( $post_id );