-
AuthorPosts
-
October 3, 2022 at 2:42 pm #1367415
Hello
we have a product category widget in the single product page
I am hiding an element in this way
li.cat-item.cat-item-462 {
display: none;
}
and it worksBut google anyway ignores that it is hidden and counts that there are 700 or more redirects on the site caused by this, and this is bad
How can hide that element (product category) in PHP instead of CSS?
Thank you
MauroOctober 4, 2022 at 6:45 am #1367496Hey profumopuntoit,
Can you try to add this PHP code in functions.php of your child theme:
add_filter( 'woocommerce_product_categories_widget_args', 'rv_exclude_wc_widget_categories' ); function rv_exclude_wc_widget_categories( $cat_args ) { $cat_args['exclude'] = array('55','68'); // Insert the product category IDs you wish to exclude return $cat_args; }
Just change the category ID.
For further information, please check this article: https://www.engagewp.com/remove-categories-woocommerce-product-category-widget/Best regards,
NikkoOctober 4, 2022 at 11:10 am #1367546Thank you Nikko,
but unfortunately it does not work
I have addedadd_filter( ‘woocommerce_product_categories_widget_args’, ‘rv_exclude_wc_widget_categories’ );
function rv_exclude_wc_widget_categories( $cat_args ) {
$cat_args[‘exclude’] = array(‘462’); // Insert the product category IDs you wish to exclude
return $cat_args;
}
but category it is still there in the codethere is a comment in that post which says
#######################
Hello,
This code is no more working in Woo Version 6.5.1
Can you please send me the updated version of this code ?
Nand
########################
Our WooCommerce Version is 6.8.2Mauro
- This reply was modified 2 years, 2 months ago by profumopuntoit.
October 6, 2022 at 9:35 am #1367772Hi Mauro,
The code should still work, there’s a comment there that it does not work, however, there’s one response to it as well that it works.
Also, you can check woocommerce’s code and see that the filter is still there.
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.- Install and activate ” Temporary Login Without Password “.
- Go to ” Users > Temporary Logins ” on the left-side menu.
- Click ” Create New “.
- Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
( to be sure that we have enough time to debug ). - Click ” Submit “.
- You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.
When your issue is fixed, you can always remove the plugin!
If you prefer to not use the plugin, you can manually create an admin user and post the login credentials in the “private data” field.Best regards,
NikkoOctober 10, 2022 at 2:57 pm #1368286This reply has been marked as private.October 11, 2022 at 12:28 am #1368360Hi Mauro,
Thanks for providing us with admin access.
Can we request for FTP access as well? since Theme File Editor has been disabled.Best regards,
Nikko -
AuthorPosts
- You must be logged in to reply to this topic.