Firewall malicious code detection in sitemap

  • Hi,

    I’ve been using and liking RankMath however my firewall (Wordfence) repeatedly detects malicious code in a xml sitemap. The name of the file appears to be system generated since the name is unrecognizable. Can you help me with this xml file? I have deleted it and the file regenerates.



Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    The error is pointing to the local cache file. I can suggest that you add the following code to your theme’s functions.php file to disable caching of the sitemap:

     * Filter if XML sitemap transient cache is enabled.
     * @param boolean $unsigned Enable cache or not, defaults to true
    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

    Looking forward to helping you. Thank you.


    Change made (line added) and monitoring… I’ll update soon!


    Hi Brian,

    Awesome, I have my fingers crossed 🙂

    Wordfence firewall needed to be changed for my server configuration. I am unsure if this change or adding the code above fixed this issue. Either way, I am no longer experiencing the error.

    Thank you for the help.



    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘Firewall malicious code detection in sitemap’ is closed to new replies.