January 23rd, 2019 - Code Snippets, Quick Tips, Woocommerce

Change Woocommerce Membership Content Per Page

Platform: WordPress
Plugins: Woocommerce, Woocommerce Memberships

Do you use the Woocommerce Membership plugin?

By default, the membership area of the my account page limits the number of content items displayed per page to the same number defined under Settings -> Reading for your blog posts.

Place the below code in your functions.php file to modify the number of items displayed per page.

function limit_wc_memberships_posts_listing( $query_args, $type, $paged ) {
	$query_args['posts_per_page'] = '20';
	return $query_args;
}
add_filter( 'wc_memberships_get_restricted_posts_query_args', 'limit_wc_memberships_posts_listing', 10, 3 );

You can read more about modifying the query at the WordPress Code WP Query page.