WordPress.org

Ready to get started?Download WordPress

Forums

XML Sitemap & Google News feeds
[Plugin: XML & Google News Sitemap Feeds] How to exclude pages from sitemap.xml (2 posts)

  1. c-bass
    Member
    Posted 2 years ago #

    hej,

    i have pages which shouldnt be seen by others and found on google (like thank you pages for measuring conversion rates...).

    how can i exclude pages/posts from the sitemap?

    http://wordpress.org/extend/plugins/xml-sitemap-feed/

  2. c-bass
    Member
    Posted 2 years ago #

    i figured out that there is a way in feed-sitemap.php in line 50.

    in the array

    // the main query
    query_posts( array(
    	'post_type' => 'any',
    //	'post_status' => 'publish',
    //	'caller_get_posts' => 1,
    //	'nopaging' => true,
    	'posts_per_page' => -1 )
    );

    add

    'post__not_in' => array(1346,1303),

    Result:

    // the main query
    query_posts( array(
    	'post_type' => 'any',
    	'post__not_in' => array(1346,1303), // exclude pages
    //	'post_status' => 'publish',
    //	'caller_get_posts' => 1,
    //	'nopaging' => true,
    	'posts_per_page' => -1 )
    );

    dont forget to clean your cache after editing the file.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic