我的朋友,有两条路要走。
Plugin:全方位搜索引擎优化(https://wordpress.org/plugins/all-in-one-seo-pack/). 生成网站地图。xml应该对您的需求非常有用。
Code:如果以后需要使用永久链接数组,我建议您使用循环(https://codex.wordpress.org/The_Loop) 循环浏览所有帖子、页面等,并向\\u permalink提供(https://codex.wordpress.org/Function_Reference/the_permalink) 在数组中。
类似这样:
<?php
// Not copy and paste safe, please read
// This sets up what we want to fetch from the database
// All the posts, pages, and any other custom post types
// Setting \'posts_per_page\' to -1 give you all the matches in the db
$args = array(\'post_type\' => array( \'post\', \'page\', \'any-other-custom-post-type\'), \'posts_per_page\' => -1 );
// Go get what we want
$WP_objects_I_will_loop_through = new WP_Query($args);
//If there are any objects in the db that match our search...
if ($WP_objects_I_will_loop_through->have_posts()):
//loop through them and...
while ($WP_objects_I_will_loop_through->have_posts()):
//...Start with the first one, and then the next and....
$WP_objects_I_will_loop_through->the_post();
//...get the right post object each time through the loop
global $post;
// Create an array to fill with URL\'s and...
$my_array_filled_with_urls = [];
// Pop them in one at a time
$my_array_filled_with_urls[] = get_permalink($post->ID);
endwhile;
endif;
// Keeps you safe if you use this somewhere near another loop
wp_reset_query();