November 26, 2014

How to Add Custom Post Type to XML-Sitemap Generator

The Problem

We recently released a new Pro Business Guide named Facebook Fan Pages for Business on our other site. We created a landing page using Premise. Premise allows for the creation of several types of landing pages with some cool features. Read more here.

The Premise landing pages are created as custom post types aptly named “Landing Page” and there are several types of landing pages to choose from. Because these are custom post types, they do not show up in your site feed (which is OK because we don’t want them to at this point), but they also do not show up in our XML Sitemap…and of course we DO want them there so search engines can easily index them and be updated of additions and changes.

We are using the XML-Sitemap Generator plugin (version 3.2.4 at time of writing). This plugin creates and updates your XML Sitemap whenever you add a new page or post BUT it does not account for custom post types.

We did our due diligence and read through the plugin documentation and forum threads, and even found a plugin that hooks into the XML-Sitemap plugin to include custom post types, but decided not to use it because of forward compatibility if the XML-Sitemap plugin gets updated to include custom post types.

The Fix

The solution to adding our custom post types to the XML-Sitemap plugin was simple, thanks to the forward thinking of the plugin developer. He included an option to add pages to the Sitemap manually by entering the URL to the page. It had been awhile since we visited the plugin settings, so we didn’t realize it was so easy right away.

Click to Enlarge

After entering the URL to our Premise custom post type page and configuring a few settings, all we had to do next was use the “Rebuild Sitemap Manually” link to rebuild our Sitemap so it would pick up our manually entered URL.

Click to Enlarge

The Result

You can clearly see in the image below that our Premise custom post type page has been added to our Sitemap.

Click to Enlarge

Update

The solution presented above worked great for our immediate needs, but what if you have dozens or even hundreds of Custom Post Types you need to add to your XML-Sitemap?

1. A function that specifically adds them:
http://www.getupandrunning.net/2010/06/adding-custom-content-types-to-the-sitemap/

2. Using Joost’s SEO plugin for WP which has this feature built-in:
http://yoast.com/wordpress/seo/#xml-sitemap

There is a plugin somewhere that hooks into the XML-Sitemap Generator plugin too, but I can’t seem to find it at the moment.

 

WP Modder runs on the Genesis Framework

Genesis Framework

Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!

Take advantage of the 6 default layout options, comprehensive SEO settings, rock-solid security, flexible theme options, cool custom widgets, custom design hooks, and a huge selection of child themes ("skins") that make your site look the way you want it to. With automatic theme updates and world-class support included, Genesis is the smart choice for your WordPress website or blog.

It's so damn good, I've redesigned all of my sites using Genesis and can confidently recommended it to you here.

Want an Awesome Host? We Recommend HostGator

HostGator for WordPress

Since its establishment in 2002, HostGator has been a world-leading provider of web hosting service. Although their office is in Houston, Texas, they provide top-notch service to clients and developers from over 200 countries internationally with a staff of over 600 employees. They offer Shared, Reseller, VPS, and Dedicated server packages for both beginners and professionals alike.

Each of their shared Web Hosting plans includes 24/7/365 support, a 99.9% uptime guarantee, and a 45-day money-back guarantee. If you would like to learn more, please visit their company page.

I use HostGator for the majority of my own sites and I continually recommend them to my clients. Learn more about HostGator now!

Get our FREE WP Topics Newsletter

The WP Topics newsletter is delivered twice monthly and it's jam packed with information on our WordPress People interviews, WordPress tutorials, new and useful plugins, themes, marketing techniques, and more.

We Respect Your Privacy.

tutorials delivered by email
* indicates required

About Adam W. Warner

I’m a web development consultant and instructor specializing in the use of WordPress and WordPress Multisite.My development philosophy focuses on solutions, education, empowerment, and support for my clients. I will provide you the tools to achieve your project goals, and I will show you how to use those tools.

Comments

  1. How to Add Custom Post Type to XML-Sitemap Generator #wordpress http://tiny.ly/L2Pf

  2. How to Add #WordPress Custom Post Types to XML Sitemaps http://bit.ly/lSKVYc

  3. Hi,
    this is a possible if you have only one or some custom posts. But it’s not a good solution if you are using many custom posts in a new post type.

    The developer has actual no solution :(

    Regards,
    Manuel

  4. wp- How to Add Custom Post Type to XML-Sitemap Generator
    http://t.co/5fPHkJh

  5. Seems that now XML Sitemap supports Custom Posts.

Speak Your Mind

*