How to list urls inside a category
-
Hello,
I’m trying to 301 redirect all of the posts of a category, but for this I need the urls of the posts in that category.
I haven’t found a quick way to do that, I’ve found solutions to get all the urls of my WordPress install but I can’t get to modify them to display only urls from the posts in one category. This is the code to get all of the urls:
<?php /* Template Name: List post links */ $postID = $wpdb->get_col(" SELECT ID FROM $wpdb->posts WHERE (post_type = 'post') AND (post_status = 'publish') AND (post_password = '') "); foreach($postID as $post_link) { ?> <a href="<?php echo get_permalink($post_link); ?>"><?php echo get_the_title($post_link);?></a><br /> <?php } ?>
Any idea?
Thanks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to list urls inside a category’ is closed to new replies.