I am creating a WooCommerce store with a very big nested menu structure. Is there a way to stop my product categories from paginating?
I need them to all show in one big list so that I can use Ctrl+F to find them quickly. That “Search” next to “View All” isn’t working.
Any help is appreciated.
Based on “Remove Pagination in Appearance -> Menus -> Categories” answer thread for WordPress categories, you will adapt the answer code to WooCommerce Product Categories.
The taxonomy of WooCommerce Product category is product_cat
.
Is also better to target admin nav menus only.
Try the following (untested):
add_filter( 'get_terms_args', 'admin_nav_menu_show_all_product_categories', 10, 2);
function admin_nav_menu_show_all_product_categories( $args, $taxonomies ) {
global $pagenow;
if( 'nav-menus.php' === $pagenow && reset($taxonomies) === 'product_cat' ) {
$args['number'] = '';
}
return $args;
}
add_filter('terms_clauses', 'change_product_cat_terms_clauses', 10, 3 );
function change_product_cat_terms_clauses( $clauses, $taxonomies, $args ) {
global $pagenow;
if( 'nav-menus.php' === $pagenow && reset($taxonomies) === 'product_cat' ) {
$clauses['limits'] = '';
}
return $clauses;
}
Code goes in functions.php
file of your active child theme (or active theme). It could works.