Hello,
Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.
Could you please also add the FTP login credentials of your site in the sensitive data section so we can investigate this issue further?
Looking forward to helping you.
Thank you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
Thank you for the additional details.
We have investigated your site and also couldn’t find any whitespace on your wp-config or functions.php file.
However, to fix this, we have uploaded a new file in the root of your website called whitespacefix.php that’s called on your installation and fixes the whitespace issue on the XML files.
Then, we included this whitespace fixer file at the beginning of the index.php file:
include('whitespacefix.php');
Please check your sitemap now and it’s opening fine. You can clear your website and browser’s cache if it’s still not opening on your end.
I hope that helps.
Thank you.
This is excellent. I can see the sitemap loading now 🙂
Our themes, plugins, and core WordPress files are under version control using Git. During a WordPress core update, it is possible that index.php will be overwritten.
Does there happen to be a similar solution that can be done outside of the core wordpress files, to ensure we don’t lose the customizations during an upgrade? Perhaps something on the server-level or within a child theme?
Many thanks!
Hello,
Since we were not able to identify the file that was adding the whitespace, we have applied a global fix. And you don’t need to worry about the changes being overridden after the update. The code will remain in that file even after the update.
Hope this clarifies your doubts.
Please don’t hesitate to get in touch in case you need any other assistance.
Thanks.
Hi,
Thank you for your response.
index.php is part of the WordPress core files and is susceptible to being changed during a WordPress update.
WordPress codex recommends not to update any core files other than wp-config.php: https://wordpress.org/support/article/editing-files/#editing-files-offline
Is there a solution similar to the whitspacefix.php that can be added to a plugin or theme to prevent any chance of this change being lost during a WordPress upgrade?
Thanks for your time.
Sean
Hello,
Because of the way this fix runs it needs to be included in the entry point of your application which in this case is the index.php
file on the root of your website.
As mentioned in the article you shared, you can just take a backup of the file and create a file with notes about the changes for future reference.
Don’t hesitate to get in touch if you have any other questions.
Hi There,
Thanks for your response!
Can you confirm if index.php gets overwritten during a standard automatic WordPress upgrade?
Thank you,
Sean
Hello,
To try and prevent the installation from overriding that file you can write-protect the file to see if that helps.
Plenty of people do this and there are even people who change the name of the index.php
file completely.
Don’t hesitate to get in touch if you have any other questions.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.