2

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.

4

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

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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