I am using the getarchives_where hook to filter and display only archives for a custom post type.
add_filter( 'getarchives_where' , 'getarchives_where_filter' );
function getarchives_where_filter( $where , $r ) {
$post_type = 'blog-posts';
return str_replace( "post_type = 'post'" , "post_type = '$post_type'" , $where );
}
It mostly works – It displays ‘November 2011’ (I only have one custom post for November) but the link to November 2011 is still linked to the archives for general posts.
Instead of example.com/blog-posts/2011/11 it sends me to example.com/2011/11
How can I fix this?
I should mention that I ‘re-saved’ my permalinks and that didn’t help the problem.
Any help would be appreciated.
Thanks
I figured it out. I had to re-save my permalinks and update the .htaccess file with the code WordPress gave me.