PenciDesign Supporter replied
Hi @weslei,
Please create a new private ticket with your WordPress admin account.
I'll check and help you.
Regards,
PenciDesign.
Good morning, I have a problem with the categories, like before the categories and subcategories were separated right, in the mobile and tablet versions the menu is correct but in the PC version when I place the mouse pointer on top it shows all the categories and subcategories I created .
Hi, the code I used to exclude posts of child categories in parent categories doesn't work anymore with wordpress 6.
Actually it shows me an empty parent category .
Can you tell me if there is a way to see in my categories only post that belong to that category with seeing the ones of child categories?
It seems that this code works well, what do you think about?
if ( !function_exists('fb_filter_child_cats') ) {
function fb_filter_child_cats( $cats ) {
global $wp_query, $wpdb;
if ( is_category() ) {
// get children ID's
if ( $excludes = get_categories( "child_of=" . $wp_query->get('cat') ) ) {
// set array with ID's
foreach ( $excludes as $key => $value ) {
$exclude[] = $value->cat_ID;
}
}
// remove child cats
if ( isset($exclude) && is_array($exclude) ) {
$cats .= " AND " . $wpdb->prefix . "term_relationships.term_taxonomy_id NOT IN (" . implode(",", $exclude) . ") ";
}
}
return $cats;
}
if ( !is_admin() ) {
add_filter( 'posts_where', 'fb_filter_child_cats' );
}
}
Thanks, I put it in child theme functions file and now it is ok.
Actually I'm working on it in a local path.
I didn't understand if you got the problem,
I have a parent category "cat1" and inside two child categories "cat1-1" and "cat1-2",
the post will have as categories cat1-1 and cat1-2,
so the question is "that post will be visible in categories page like cat1-1 and cat1-2 or also in cat1 list posts?
Hi, I've noticed that in a parent category I see also posts from child categories.
Is it a bug? How I can disable this?
Want to join this conversation or access attachments? Sign in first.
Open your ticket archive, review validated licenses, and continue product support conversations from one customer portal.