admin管理员组文章数量:1128196
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.
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.
Share Improve this question edited May 21, 2019 at 9:52 LoicTheAztec 3,38117 silver badges24 bronze badges asked May 20, 2019 at 22:50 Charis The ProgrammerCharis The Programmer 1235 bronze badges 2- 1 @LoicTheAztec your code worked! Thank you very much. However the pagination is still showing but the code is doing what I needed done. – Charis The Programmer Commented May 24, 2019 at 15:48
- Happy it wordked, as I didn't really test my code (what I mostly never do). – LoicTheAztec Commented May 24, 2019 at 15:52
2 Answers
Reset to default 2Based 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.
Thanks LoicTheAztec, it works for me. Pagination destroys my product category hierarchy and displays in the wrong positions. But after your code snippet, pagination still displays, so Ive added this:
function admin_product_cat_terms_nopagination($hook_suffix) {
if ( $hook_suffix == 'nav-menus.php' ) {
echo '<style>#tabs-panel-product_cat-all .add-menu-item-pagelinks{ display:none }</style>';
}
}
add_action('admin_enqueue_scripts', 'admin_product_cat_terms_nopagination');
本文标签: custom taxonomyRemove pagination from WooCommerce product categories on admin edit navigation menus
版权声明:本文标题:custom taxonomy - Remove pagination from WooCommerce product categories on admin edit navigation menus 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736718550a1949336.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论