phpwordpresspermalinks

How to show all permalinks of wordpress?


I want to show all current permalinks of my wordpress posts in just one page. I don't want to use archives. I use database to do this, but its showing only guid links.

Means I want to make list like this:

http://www. mywebsite. com/category/post1 http://www. mywebsite. com/category/post1 http://www. mywebsite. com/category/post1

but what I am getting from database is:

http://www. mywebsite. com/?p=1 http://www. mywebsite. com/?p=2 http://www. mywebsite. com/?p=3

Please help me


Solution

  • try this

    <?php 
     $args = array('post_type' => 'post', 'posts_per_page' => -1 ); 
     $loop = new WP_Query($args); 
     if( $loop->have_posts() ): 
         while( $loop->have_posts() ): 
             $loop->the_post(); 
             global $post; 
             echo get_permalink($post->ID);
         endwhile; 
     endif; 
     wp_reset_query();
    ?>
    

    set your permalink settings to postname first.

    Have fun :)