• I think this may be a bug, but currently when posts are published to the sites I’m running wordfence on via an XML-RPC process the cache is not cleared.

    The XML-RPC posts do not appear unless the cache is manually cleared or a post is published by normal means.

    I’m guessing it may be as simple as adding an action to the xmlrpc_publish_post event. Something like the snippet below replacing the ???? with whatever function is needed to clear the wordfence cache.

    add_action('xmlrpc_publish_post', '????', 15 );

    Can someone let me know if I’m on the right track and if so what is the function I’m after?

    https://www.ads-software.com/plugins/wordfence/

Viewing 4 replies - 1 through 4 (of 4 total)
  • @mkokes

    Posting this question to our dev team to answer and look into. I'[ll let you know what I find. (ticket in that system is 611, in case you need to reference it for the devs of they reach out)

    tim

    Thread Starter Marty Kokes

    (@mkokes)

    I believe I fixed the problem, but you guys will need to update your code or my patch will just be overwritten anytime there’s a update.

    in /lib/wfCache.php

    It looks like you’re calling ‘action_publishPost’ with the publish_post hook to schedule the cache to be cleared. This hook isn’t triggered when a post is published by xml-rpc or if it’s scheduled to be published in the future.

    Since there will be no login cookie at the time of posting I inserted the code right after the if statement where the publish_post hook is being used. Roughly line 32.

    }
    		}
    		add_action('wordfence_cache_clear', 'wfCache::scheduledCacheClear');
    		add_action('wordfence_update_blocked_IPs', 'wfCache::scheduleUpdateBlockedIPs');

    becomes…

    }
    		}
    		add_action('publish_future_post', 'wfCache::action_publishPost');
    		add_action('xmlrpc_publish_post', 'wfCache::action_publishPost');
    		add_action('wordfence_cache_clear', 'wfCache::scheduledCacheClear');
    		add_action('wordfence_update_blocked_IPs', 'wfCache::scheduleUpdateBlockedIPs');
    Thread Starter Marty Kokes

    (@mkokes)

    Caching still does not get flagged to be cleared with the most recent update when scheduled posts or posts made with xml-rpc are published. Is there a proper place to submit this patch?

    Thread Starter Marty Kokes

    (@mkokes)

    Recent update still did not contain this patch, still wondering where the best place to submit this is.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to clear cache when a post is published via XML-RPC?’ is closed to new replies.