Reputation: 173
I have a stragne question, I have been gogoleing for a while, but have found no answer. I have a Wordpress site where the Yoast Seo plugin has been installed, titles, descriptions have been added, I could also manage to change the title tag, canonical url generated by it with the wpseo- filters.
The sitemap xmls are also generated fine, but I would need to add additional pages to it. We have a search page on the site, we search by a rental custom post type. Rentals can be searched by location. The search page is eg.: /rentals.
We have found, that there are several sites (I can show you one in hungarian, but I'm sure you will get it) where the search results are indexed by google. Like this one:
You get to this page if you search hotels paris. If you have a look at this page, this is already a search result, search parameters are set. Now we would like to do the same with the Wordpress site. I have done a redirection for the urls: /rentals/budapest /rentals/hungary ... there are more locations. so they go to the rentals page, where I set the search parameters, I have changed the canonical urls of these pages, but I would like to add these pages to the xml sitemap also. The problem is that these page do not exist in the database.
Is there a filter that I coul use to add these pages to the sitemap.xml in Yoast Seo plugin?
Has anyone done a similar thing in wp?
Any help is appreciated, thank you!
Upvotes: 2
Views: 5497
Reputation: 173
I have found the answer! There is a wpseo_do_sitemap_ filter, I had to use that one. Also, This filter only created a custom sitemap, I also needed the 'wpseo_sitemap_index' filter to add my custom sitemap xml to the sitemaps index page. Detailed solution was found under this link!
https://gist.github.com/mohandere/4286103ce313d0cd6549
Upvotes: 6