apgmxs_autobuild

Auto Build sitemap.

Description

apgmxs_autobuild( $postID ); 

Parameters (1)

0. $postid
The postID.

Usage

  1. if ( !function_exists( 'apgmxs_autobuild' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-monthly-xml-sitemap/monthly-xml-sitemap.php'; 
  3.  
  4. // The postID. 
  5. $postid = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = apgmxs_autobuild($postid); 
  9.  

Defined (1)

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

/monthly-xml-sitemap.php  
  1. function apgmxs_autobuild($postID) { 
  2. global $wp_version; 
  3. $isScheduled = false; 
  4. $lastPostID = 0; 
  5. //Ricostruisce la sitemap una volta per post se non fa import 
  6. if($lastPostID != $postID && (!defined('WP_IMPORTING') || WP_IMPORTING != true)) { 
  7.  
  8. //Costruisce la sitemap direttamente oppure fa un cron 
  9. if(floatval($wp_version) >= 2.1) { 
  10. if(!$isScheduled) { 
  11. //Ogni 15 secondi. 
  12. //Pulisce tutti gli hooks. 
  13. wp_clear_scheduled_hook(apgmxs_generate_sitemap()); 
  14. wp_schedule_single_event(time()+15, apgmxs_generate_sitemap()); 
  15. $isScheduled = true; 
  16. } else { 
  17. //Costruisce la sitemap una volta sola e mai in bulk mode 
  18. if(!$lastPostID && (!isset($_GET["delete"]) || count((array) $_GET['delete'])<=0)) { 
  19. $lastPostID = $postID;