Как скрыть пустые рубрики из меню WordPress
Чтобы пустые рубрики, в которых не содержатся записи или товары, не показывались в меню на сайте, нужно в файл function.php вашей темы поставить следующий код:
add_filter( 'wp_get_nav_menu_items', 'gowp_nav_remove_empty_terms', 10, 3 );
function gowp_nav_remove_empty_terms ( $items, $menu, $args ) {
global $wpdb;
$empty = $wpdb->get_col( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE count = 0" );
foreach ( $items as $key => $item ) {
if ( ( 'taxonomy' == $item->type ) && ( in_array( $item->object_id, $empty ) ) ) {
unset( $items[$key] );
}
}
return $items;
}
комментариев 27
1diocese
free gay dating sites grindr https://gayfade.com
local gay dating https://gaysugardaddydatingsites.com
gay chat room https://bjsgaychatroom.info/
gay military dating scam https://gaypridee.com/
gay web cam chat room https://gaytgpost.com/
kik chat gay penis https://gay-buddies.com/
gay black dating https://speedgaydate.com/
slots winning video 2022 https://2-free-slots.com/
mr gamez free slots https://freeonlneslotmachine.com/
princess bride slots https://candylandslotmachine.com/
quick hit slots facebook https://pennyslotmachines.org/
free penny slots https://slotmachinesworld.com/
free fun slots no download https://slotmachinesforum.net/
free double diamond slots https://slot-machine-sale.com/
harrington slots buffet https://beat-slot-machines.com/
free slots 777 sizzling 7s https://download-slot-machines.com/
igt free slots https://411slotmachine.com/
caesars slots free casino https://www-slotmachines.com/
penny slots free online https://slotmachinegameinfo.com/
how long does a dissertation have to be https://buydissertationhelp.com/
site:tickettailor.com dissertation help https://dissertationwriting-service.com/
dissertation process https://help-with-dissertations.com/
writing dissertation tips https://mydissertationwritinghelp.com/
online dissertation writing https://dissertations-writing.org/
writing acknowledgements for dissertation https://helpon-doctoral-dissertations.net/
1importantly