Support » Fixing WordPress » Export media library

  • Is there a way to export all of my images from my media library. For example, a list of what every image is named, the alt tags, descriptions, etc..

    Thanks!
    Brett

Viewing 1 replies (of 1 total)
  • Media library items are considered attachments, so via http://codex.wordpress.org/Template_Tags/get_posts#Show_all_attachments you can retrieve them all from the db like so:

    Show all attachments

    Do this outside any Loops in your template.

    <?php
    $args = array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'post_status' => 'any', 'post_parent' => null );
    $attachments = get_posts( $args );
    if ( $attachments ) {
    	foreach ( $attachments as $post ) {
    		setup_postdata( $post );
    		the_title();
    		the_attachment_link( $post->ID, false );
    		the_excerpt();
    	}
    	wp_reset_postdata();
    }
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Export media library’ is closed to new replies.