Hi Matt,
Thanks!
About the filter:
I will add the requested filters in the next update. I’ll keep you updated on how they will work.
Alternative:
If you don’t wish to include a page in the sitemap, I believe you might also want to exclude it from Search Engine Result Pages?
If this is the case, simply check the “NoIndex” box on the SEO Settings within the page edit screen. This will effectively remove the page from the sitemap as well.
About the query:
Thank you very much for the suggestion as well, any input is greatly appreciated. I took your suggestion to the test below:
About the combining of the fetch into 1 query:
You’re right! Alas, this isn’t possible with the get_posts()
function considering the possible post amount filters (4 different filters).
Also, doing so will make the sitemap links generation much harder. As we have to check in each loop what kind of post type it is. With thousands of posts, this is quite hefty. Reading more down the line of the code, you see I treat Pages and Posts/CPT quite differently.
About the how-to-combine SQL link:
Great stuff :D. I love to learn!
I do have to note that this plugin (like many others) is dependent on the WordPress core, and rewriting the query function is a hefty and very prone be a buggy task. Especially if you consider it to be more than 1200 lines of code long, which can be changed at any future Core update. Including consideration of MariaDB, SQL Server, MySQLi, PostgreSQL, etc.:
WP_Query::get_posts()
All with all, I took the liberty of speed-testing the queries, results may vary:
Pages fetch: 0.0007419586181640625 seconds
Posts fetch: 0.000771045684814453125 seconds
CPT calculation (no CPT registered): 1.1920928955078125-5 seconds
CPT calculation + fetch (WooCommerce + bbPress + AnsPress): 0.0058460235595703125 seconds
I think it’s quite negligible :), what do you think?
I hope this clears things up, I’ll keep you posted!