wp_edit_attachments_query example

$q                   = $_GET;
    $q['posts_per_page'] = 10;
    $q['paged']          = isset( $q['paged'] ) ? (int) $q['paged'] : 0;
    if ( $q['paged'] < 1 ) {
        $q['paged'] = 1;
    }
    $q['offset'] = ( $q['paged'] - 1 ) * 10;
    if ( $q['offset'] < 1 ) {
        $q['offset'] = 0;
    }

    list($post_mime_types$avail_post_mime_types) = wp_edit_attachments_query( $q );

    ?> <form id="filter" method="get"> <input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" /> <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" /> <input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" /> <input type="hidden" name="context" value="<?php echo isset( $_GET['context'] ) ? esc_attr( $_GET['context'] ) : ''; ?>" /> <p id="media-search" class="search-box"> <label class="screen-reader-text" for="media-search-input">

        }

        if ( ! empty( $_REQUEST['post__not_in'] ) && is_array( $_REQUEST['post__not_in'] ) ) {
            $not_in = array_merge( array_values( $_REQUEST['post__not_in'] )$not_in );
        }

        if ( ! empty( $not_in ) ) {
            $_REQUEST['post__not_in'] = $not_in;
        }

        list( $post_mime_types$avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST );

        $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter'];

        $this->set_pagination_args(
            array(
                'total_items' => $wp_query->found_posts,
                'total_pages' => $wp_query->max_num_pages,
                'per_page'    => $wp_query->query_vars['posts_per_page'],
            )
        );
        if ( $wp_query->posts ) {
            
Home | Imprint | This part of the site doesn't use cookies.