Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "wp-load.php";
- /* You have 2 options in the line below:
- status=publish
- ... will return posts and pages with type, URL and title,
- status=any
- ... will return in addition any attachments such as images
- in that post immediately after in the list with URL and file name. */
- $posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=any');
- $posts = $posts->posts;
- $categories = get_categories('hide_empty=false');
- header('Content-type:text/plain; charset=utf-8');
- foreach($posts as $post) {
- switch ($post->post_type) {
- case 'attachment':
- $permalink = get_attachment_link($post->ID);
- break;
- case 'page':
- $permalink = get_page_link($post->ID);
- break;
- case 'post':
- $permalink = get_permalink($post->ID);
- break;
- default:
- $permalink = get_post_permalink($post->ID);
- break;
- }
- echo "\n{$post->post_type}\t{$permalink}";
- }
- foreach ($categories as $cat) {
- $id = get_the_ID();
- $category = get_the_category($id);
- echo "\ncategory\t";
- echo ''.get_option('home').'/'.get_option('category_base').'/'.$cat->category_nicename.'';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement