Getting a Listing Of All Post Permalinks in WordPress

I decided to write a blog in django, it's about 95% done. The end goal is to migrate everything from this wordpress powered site to the new one. The url patterns are different on my new blog so I have to do some rewrites. Because of how the permalinks are structure in this blog I need to re-write each one to match the new url pattern. Sooo I need a list of all the permalinks. This is what I came up with, man I haven't written anything in php in FOREVER. /var/www/



global $post;

$count_posts = wp_count_posts();

$published_posts = $count_posts->publish;

$args = array('numberposts' =>$published_posts);

$myposts = get_posts($args );

foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php the_permalink(); ?> <br/>
<?php endforeach; ?>


This outputs a list of permalinks:

Tagged as permalinks , php wordpress
Written by Andrew Konkol on April 3rd, 2012


Log in with Twitter, Google, Facebook, LinkedIn to leave a comment.