The exciting process of launching your own WordPress website starts with finding a reliable hosting provider and setting up your page. But even when you are done with it – your journey is far from over. The next step is making yourself seen.
Google and other search engine platforms are getting billions of search requests every day, and reaching the top pages for your industry terms will guarantee a hefty flow of traffic coming your way.
But how do you get there with so many other websites fighting for the spot?
First of all, you have to ensure that search engine crawlers can easily find and understand what your page is all about. Here is where the WordPress sitemap comes into play.
What is a WordPress Sitemap?
Simply put, the WordPress sitemap is like a search engine roadmap that contains a list of all your pages and the correlation between them. It’s like a tree structure of your entire WP site, signifying not only which page goes where but also their importance in the context of your website.
Search engine robots have a different perspective than the average user. Site visitors want pages to look great, load fast, and contain useful functionalities. As long as your WordPress website is optimized for performance and covers the above aspects – people will flock.
Web crawlers, on the other hand, see things differently. They have to inspect and understand millions of pages each day, and for that, they have to maximize efficiency by skipping all unnecessary components. The sitemap strips down your website to the bare minimum for the crawler to get all the information needed for its structure and content.
Why Do you Need a WordPress Sitemap?
Strictly speaking, neither Google nor any other search engine requires you to have a sitemap. Search engine robots will still detect all allowed pages and try to determine what your website is all about.
The key difference is Efficiency.
There is really no point in making the crawlers’ jobs more difficult. The more comprehensive your pages are to them – the better your chances to improve your SEO. That goes double for larger WordPress websites with many underlying URLs. The sitemap is a great time-saver for crawlers and Google highly appreciates that.
IMPORTANT: Page crawlers don’t follow a specific schedule. If you want to positively affect the process after making any structural changes – you can resubmit your sitemap to alert them there is something new with your metadata.
Difference Between XML and HTML WordPress Sitemaps?
In terms of format, you can find two types of WordPress sitemaps – XML and HTML.
The simple way to display your WordPress site structure is via HTML code. This means your sitemap will basically look like a list of categories that you can easily navigate between. This setup helps not only search engine bots but also visitors who want to quickly navigate around the site without the need for a fancy user interface.
![What is a WordPress Sitemap and How to Generate One? What is a WordPress Sitemap and How to Generate One?, Difference Between XML and HTML WordPress Sitemaps?](https://www.scalahosting.com/blog/wp-content/uploads/2021/12/image7-1024x578.png)
Here is a good example of an HTML sitemap:
Source: Connect Internet Solutions
But when it comes to WordPress-built projects (and most modern websites), an XML format is most often the way to go. There is little to no visible difference from a user’s perspective, but crawler bots get a lot more information than mere page names and relations. Behind the scenes, the code contains valuable metadata tags about the topic and the overall content of each page.
![What is a WordPress Sitemap and How to Generate One? What is a WordPress Sitemap and How to Generate One?, Difference Between XML and HTML WordPress Sitemaps? 2](https://www.scalahosting.com/blog/wp-content/uploads/2021/12/image3.png)
Here is how an XML sitemap often looks:
Source: Help Desk Geek
To summarize it all, the HTML sitemap is well-suited for human reading, while the XML format best serves search engine robots.
IMPORTANT: You are not limited to using one or the other sitemap format. You can easily configure both HTML and XML sitemaps and display the version you want, depending on who is sending the request.
How to Generate a WordPress XML Sitemap Manually?
Now for the practical part.
Let’s start off from the deep end – generating a WordPress XML sitemap without a plugin. Naturally, manual core and add-on installations are mainly preferred by experienced developers. Still, even if you lack the technical skills – you can try it out by following a few simple steps:
- You need to copy the code for your WordPress XML sitemap. You can use this one:
// add_action(“publish_post”, “eg_create_sitemap”);
// add_action(“publish_page”, “eg_create_sitemap”);
add_action( “save_post”, “eg_create_sitemap” );
function eg_create_sitemap() {
if ( str_replace( ‘-‘, ”, get_option( ‘gmt_offset’ ) ) < 10 ) { $tempo = ‘-0’ . str_replace( ‘-‘, ”, get_option( ‘gmt_offset’ ) ); } else { $tempo = get_option( ‘gmt_offset’ ); } if( strlen( $tempo ) == 3 ) { $tempo = $tempo . ‘:00’; } $postsForSitemap = get_posts( array( ‘numberposts’ => -1,
‘orderby’ => ‘modified’,
‘post_type’ => array( ‘post’, ‘page’ ),
‘order’ => ‘DESC’
) );
$sitemap .= ” . ”;
$sitemap .= “\n” . ” . “\n”; $sitemap .= “\t” . ” . “\n” . “\t\t” . ” . esc_url( home_url( ‘/’ ) ) . ” . “\n\t\t” . ” . date( “Y-m-d\TH:i:s”, current_time( ‘timestamp’, 0 ) ) . $tempo . ” . “\n\t\t” . ‘daily’ . “\n\t\t” . ‘1.0’ . “\n\t” . ” . “\n”; foreach( $postsForSitemap as $post ) { setup_postdata( $post); $postdate = explode( ” “, $post->post_modified ); $sitemap .= “\t” . ” . “\n” . “\t\t” . ” . get_permalink( $post->ID ) . ” . “\n\t\t” . ” . $postdate[0] . ‘T’ . $postdate[1] . $tempo . ” . “\n\t\t” . ‘Weekly’ . “\n\t\t” . ‘0.5’ . “\n\t” . ” . “\n”; } $sitemap .= ”;
$fp = fopen( ABSPATH . “sitemap.xml”, ‘w’ );
fwrite( $fp, $sitemap );
fclose( $fp );
}
- Log in to your WordPress dashboard.
- On the left menu, go to Appearance and choose Theme Editor.
![What is a WordPress Sitemap and How to Generate One? What is a WordPress Sitemap and How to Generate One?, How to Generate a WordPress XML Sitemap Manually?](https://www.scalahosting.com/blog/wp-content/uploads/2021/12/image4.jpg)
- On the right of your next screen, you will see a column Theme Files. Click on the one named functions.php.
![What is a WordPress Sitemap and How to Generate One? What is a WordPress Sitemap and How to Generate One?, How to Generate a WordPress XML Sitemap Manually? 2](https://www.scalahosting.com/blog/wp-content/uploads/2021/12/image1-1024x445.jpg)
- Paste the code you copied in step 1 on the bottom (unless another location is specified in the file). Hit Update.
- Submit the sitemap from the Google Search Console (we will show you how to do it later in this guide).
IMPORTANT: The above code is only good for creating a very basic sitemap with limited functionalities. To take full advantage of this method, you can use one of the many WordPress sitemap plugins out there.
How to Generate a WordPress XML Sitemap via Plugin?
One of the main reasons why WordPress is so popular is because of its rich add-on architecture. To date, there are over 55,000 official WP plugins and thousands of more stunning themes for the visual outlook of your pages.
Naturally, WordPress developers have plenty of solutions for easy sitemap creation and submission, given the importance of this task. Here are a few of the top plugin choices:
- All in One SEO
- Google XML Sitemap
- Simple Sitemap
- Sitemap by BestWebSoft
Apart from these specific sitemap add-ons, numerous multipurpose plugins like Yoast and Jetpack offer this functionality, among many others.
Today, we are going to show you how to generate a WordPress XML sitemap via All in One SEO:
- Install All in One SEO.
- A new menu for the plugin will appear on your left sidebar. Choose the Sitemaps option under it.
![What is a WordPress Sitemap and How to Generate One? What is a WordPress Sitemap and How to Generate One?, How to Generate a WordPress XML Sitemap via Plugin?](https://www.scalahosting.com/blog/wp-content/uploads/2021/12/image5.jpg)
- On the next screen, click on the General Sitemap tab.
- Make sure the Enable Sitemap option toggle is Enabled.
![What is a WordPress Sitemap and How to Generate One? What is a WordPress Sitemap and How to Generate One?, How to Generate a WordPress XML Sitemap via Plugin? 2](https://www.scalahosting.com/blog/wp-content/uploads/2021/12/image6-1024x466.jpg)
- Your WordPress XML sitemap is now created, and you can check it out by clicking on the blue Open Sitemap button.
This will bring out a list of your sitemaps, each serving a different content type.
![What is a WordPress Sitemap and How to Generate One? What is a WordPress Sitemap and How to Generate One?, How to Generate a WordPress XML Sitemap via Plugin? 3](https://www.scalahosting.com/blog/wp-content/uploads/2021/12/image2.png)
No need to submit your sitemap to search engines additionally – All in One SEO has already sent the index to Google, Bing, and other popular search engines.
How to Submit a WordPress XML Sitemap?
In some use cases, you would have to manually submit your XML sitemaps. You can do so through the Google Search Console.
Google is undoubtedly the market leader when it comes to web searches, offering a wealth of handy solutions to improve your visibility and rankings. One such service is their Search Console.
Submitting your WordPress sitemap is as simplified as possible:
- Log in to the Google Search Console.
- Go to Index and choose the Sitemap option.
- Input the URL of your WordPress sitemap(s).
- Click Submit.
The web crawlers will still need some time to get to your new sitemap and analyze it, but at this point, you have done everything on your part.
Congratulations on your first steps in WordPress SEO!
Conclusion
We hope you found our WP sitemap guide useful for your needs and learned how to efficiently help search engine crawlers find and understand your website.
If you are having trouble with your WordPress sitemap – contact the ScalaHosting Team, and we will be glad to assist more.
FAQ
Q: Does WordPress have a sitemap?
A: By default, WordPress supports its own sitemap function. However, the generated file is very basic and does not allow further customization. Furthermore, this default sitemap encompasses your entire content, including anything you might want no-indexed. This may lead to unexpected PHP errors and other inconveniences down the line, so you are best trusting a WordPress sitemap plugin for the job.
Q: How do I find my WordPress sitemap?
A: If you are unsure if your website has a sitemap already, you can check by typing your domain URL with any of these suffixes – /sitemap, /sitemap.xml, or /sitemap_index.xml.
Alternatively, you can trust one of the helpful third-party online solutions for the job. We can recommend SEO Site Checkup’s sitemap tool as a tested and working solution.
Q: How many sitemaps should I have?
A: There is no rule of thumb when it comes to the number of sitemaps a website should have. Typically, it’s good to have at least two – the XML and HTML version of your roadmap. Still, there are cases when you might need more than that.
As sitemaps are limited in size, large websites with lots of URLs can easily go overboard and create a mess. Grouping them in multiple sitemaps is a much smarter choice in such cases. Different site structures may also require the use of more than one URL list as well.