HI again Simon 🙂
You are right, that’s currently, and generally the best way to do it, because for such thing I really don’t want to rely on the database. Anyway, in the next major version, which is expected to be released this week, I will add a hook to the default post and page module so that you can simply filter the WHERE part of the query, like ID NOT IN (1,2,3,4). Is that OK for you?
That’s great – a filter hook sounds like the perfect answer.
Cheers!
Simon
i’m having problems getting this to work for page exclusion using the new bwp_gxs_post_where
filter. here’s my code:
function sitemap_where( $post_type ) {
switch ( $post_type ) {
case 'page' :
return ' AND wposts.ID NOT IN (128,187,5339) ';
break;
}
return '';
}
but those pages are still showing in the sitemap (i deleted the sitemap cache so they are freshly rebuilt).
thanks
simon
Simon,
I’ve sent you an email with patch and instructions, hope it helps :).
Afraid it’s not working with the patch, the excluded pages are still in the sitemap…
Simon,
Sorry for that, I have a typo in my example (fixed, thanks to you!), you should replace your filter with this:
add_filter('bwp_gxs_post_where', 'sitemap_where', 10, 2);
function sitemap_where( $query, $post_type ) {
switch ( $post_type ) {
case 'page' :
return ' AND wposts.ID NOT IN (128,187,5339) ';
break;
}
return '';
}
I’m pretty sure it will work now :).
that’s perfect thanks, works a treat now.