Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter lydia0uk

    (@lydia0uk)

    Hi

    No im still having the same issue and if someone is paying by credit card im still having that pdf in the mail

    Thread Starter lydia0uk

    (@lydia0uk)

    hi, I tried with the following and seems like im on the right path but now facing this issue:

    I have categories and subcategories, there are no products in the categories, if there is a subcategorie cos i will add the product there. with this snipp, it does also hide the empty categories with not empty subcategories

    any idea?

    add_filter( 'wp_get_nav_menu_items', 'nav_remove_empty_category_menu_item', 10, 3 );
    function nav_remove_empty_category_menu_item ( $items, $menu, $args ) {
        global $wpdb;
        $nopost = $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, $nopost ) ) ) {
                unset( $items[$key] );
            }
        }
        return $items;
    }
Viewing 2 replies - 1 through 2 (of 2 total)