Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When you are at the comments menu in wp-admin you only see 20 comments at the time, so if you want to delete alla comments you can ONLY mark the 20 comments you see on current page. It dosent mark comments that are on the next page.

Found a solution but dont know where to look for it

In WP-admin -> Screen layout there you can see that its only set to 20 comments a page. I know that i could just access the screen layout and set it to maximum (999 comments a page).

Now the question is can I set that value (999) to default for every user i create ? Or just basicly for the whole network?

Follow question:: If its possible, then whats the best way to do it ?

NOTE : Im using latest WordPress version with Multisite network.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

You can use

add_filter('edit_comments_per_page', 'return_999');
function return_999(){
    return 999;
}

since the user options are filtered in the WP_List_Table::get_items_per_page() class method :

/**
 * Get number of items to display on a single page
 *
 * @since 3.1.0
 * @access protected
 *
 * @return int
 */
function get_items_per_page( $option, $default = 20 ) {
        $per_page = (int) get_user_option( $option );
        if ( empty( $per_page ) || $per_page < 1 )
                $per_page = $default;

        return (int) apply_filters( $option, $per_page );
}

So you could do the same for edit_post_per_page and edit_page_per_page.

Or if you have other custom post types: edit_{CPT}_per_page.

share|improve this answer
add comment

That value is set on a per user basis and saved as user meta. We can intercept and modify it to a fixed value using the filter get_{$meta_type}_metadata.

Create a Must Use plugin and it will be active in all the Network:

add_filter( 'get_user_metadata', 'comments_per_page_wpse_95420', 10, 4 );

function comments_per_page_wpse_95420( $check, $object_id, $meta_key, $single )
{ 
    if( 'edit_comments_per_page' == $meta_key )
        return 999;

    return $check;
}

Related Q&A: How to list ALL Pages in the dashboard?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.