rankmath / seo-by-rank-math

Rank Math is a revolutionary WordPress SEO Plugin that combines the features of many SEO tools and lets you multiply your traffic in the easiest way possible :bulb: :chart_with_upwards_trend: →
https://rankmath.com
107 stars 52 forks source link

[Sitemap] Entry not added to robots.txt #288

Open rcnascimento opened 2 months ago

rcnascimento commented 2 months ago

Describe the bug The sitemap is enabled but the link is not added after my custom robots.txt content.

To Reproduce Steps to reproduce the behavior:

  1. Make sure the Sitemap is enabled and working (menu "Sitemap Settings");
  2. Save a custom robots.txt via plugin (menu "General Settings", tab "Edit robots.txt");
  3. Open the generated robots.txt file in browser;
  4. The line with sitemap reference is not there.

Expected behavior The plugin must auto add the sitemap index reference to the robots.txt. At the end of generated file.

rcnascimento commented 2 months ago

I have changed this hook callback priority to 10 (the usual) and now the line appears on my robots.txt:

https://github.com/rankmath/seo-by-rank-math/blob/13a1ce8bfb08288151c2fe737ea74dc355c17b02/includes/modules/sitemap/class-sitemap-index.php#L30