fixed purge_post empty 2nd param master
fixed purge_post empty 2nd param

file:a/readme.txt -> file:b/readme.txt
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@
 Tags: varnish, purge, cache, caching, optimization, performance, traffic
 Requires at least: 4.0
 Tested up to: 4.8
-Stable tag: 1.6.1
+Stable tag: 1.6.2
 License: GPLv2 or later
 
 Wordpress Varnish Cache 3.x/4.x/5.x integration
@@ -116,6 +116,9 @@
 
 == Changelog ==
 
+= 1.6.2 =
+* fixed purge_post empty 2nd param
+
 = 1.6.1 =
 * Do/do not purge when saving menus option
 * fixed bug showing multiple `Truncate message activated ...`

--- a/vcaching.php
+++ b/vcaching.php
@@ -3,7 +3,7 @@
 Plugin Name: Varnish Caching
 Plugin URI: http://wordpress.org/extend/plugins/vcaching/
 Description: WordPress Varnish Cache integration.
-Version: 1.6.1
+Version: 1.6.2
 Author: Razvan Stanga
 Author URI: http://git.razvi.ro/
 License: http://www.apache.org/licenses/LICENSE-2.0
@@ -421,10 +421,10 @@
         do_action('vcaching_after_purge_url', $url, $purgeme);
     }
 
-    public function purge_post($postId, $post)
+    public function purge_post($postId, $post=null)
     {
         // Do not purge menu items
-        if ($post->post_type == 'nav_menu_item' && $this->purgeOnMenuSave == false) {
+        if (get_post_type($post) == 'nav_menu_item' && $this->purgeOnMenuSave == false) {
             return;
         }
 

comments