Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Function to list all post slugs for every post in wp_posts table?

I assume there's an official function to generate a post slug, but maybe someone here already has the answer.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

example - unordered list with post slugs:

<ul>
  <?php foreach( get_posts('numberposts=-1') as $post ) { 
    echo '<li>' . $post->post_name . '</li>'; 
  } ?>
</ul>

http://codex.wordpress.org/Template_Tags/get_posts

share|improve this answer
1  
Thanks for the quick answer Michael. I'm actually moving posts out of WP so technically I'm not "in the loop". Surprisingly, I found the answer through Google Plus almost immediately after I posted the question: PJ Brunet - +Lloyd Budd I didn't see the slug in wp_posts, I'll check the_permalink() that's probably what I need. Lloyd Budd - +PJ Brunet the column is post_name. PJ Brunet - That worked. For example "select post_name from wp_posts LIMIT 500;" That's pretty much what I needed. –  PJ Brunet Jul 14 '11 at 21:08
    
reference to database tables: codex.wordpress.org/Class_Reference/wpdb#Tables –  Michael Jul 14 '11 at 21:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.