codemine supports this item


This author's response time can be up to 1 business day.

Popular questions for this item

I get the error “The package could not be installed. No valid plugins were found. Plugin install failed.” when I try to install the plugin.

Make sure that you are uploading the correct zip file to your WordPress site. Which is And not the whole zip file that you have downloaded from envato.

I have product categories with a parent-child relation and the plugin seems to break the menu

if the category you want to hide is a subcategory, and it’s parent category has no products attached to it, then the plugin may not work as expected. Please attach at least one product to it’s parent category.

In other words, you should ensure that no product categories are empty. To check if you have empty product categories, go to your site’s backend and navigate to Products > Categories. Check there if you have any categories with zero (0) products (the count column). If you have, assign the empty category to it’s products.

Let’s take a practical example. Let’s say you have a category clothes with a subcategory shirts. When you create a product, you should assign both the clothes and shirts at the same for the desired product. Not only the shirts category.

If you go to backend and see that the shirts category has a count of 0 and the shirts a count ,eg. of 10, than you should add the clothes category to all the shirts products.

Solution 1

To do so easily, just follow these steps:

  1. Click the count number right next to the shirts category. This will lead you to all the proucts that have the shirts category.
  2. Select all the products by checking the tick box right next to each product (or by using the global tick box right down the bulk actions select box).
  3. On the Bulk actions select box, select the edit option.
  4. Press Apply.
  5. Go to the product categories box, and tick the clothes categoriy.
  6. Press Update on the bottom right part and you are set!

Solution 2

As an alternate solution, you can add this filter in your functions.php.

add_filter('wcpv_visibility_only_selected_tax',  'wcpv_show_tax');

function wcpv_show_tax() {
    return true;

I have a WPML multilingual site, but the plugin does not hide the products in all languages

Make sure that all of your products, tags and categories on your default language, have been properly translated through WPML.

Also, if you have a caching plugin activated, make sure that you have cleared the cache.

I want to be able to give the direct URL for hidden categories

To do so, just open your functions.php and paste the code below:

add_action('pre_get_posts', 'wcpv_modify_main_query_categories_directurl');

function wcpv_modify_main_query_categories_directurl($query) {
    // hide products in shop page
    if (is_shop()) {
    // show products in archive pages
    if ($query->is_archive() && $query->is_main_query()) {
        $query->set('is_category_page', 'true');

add_filter('wcpv_where', 'wcpv_categories_directurl', 10, 2);

function wcpv_categories_directurl($subquery, $query) {
    if (isset($query->query_vars['is_category_page'])) {
        $subquery = '';
    return $subquery;

Can I remove all products for a user role?

Yes, it is possible with a small patch. Let’s say that we want to hide all products for the shop manager user role. Here are the steps:

  1. Go to the plugin’s backend page and add a rule (any rule) to the role you want to hide the products. In our example, go to shop manager and hide just one category (eg. shirts).
  2. Open your functions.php and paste the code below. Make sure that you replace the shop_manager role at our code with your own user role.
add_action('posts_where_paged', 'wcpv_modify_main_query_remove_all', 1, 2);

function wcpv_modify_main_query_remove_all($where, $query) {
    if (wcpv_get_user_role() == 'shop_manager') { // Replace the shop_manager role here, with your own user role, eg. administrator, etc.
        $post_type = $query->query_vars['post_type'];
        $product_category_check = isset($query->query_vars['taxonomy']) ? $query->query_vars['taxonomy'] : null;
        if ($post_type == 'product' || $post_type == 'any' || (isset($product_category_check) && ( $product_category_check == 'product_cat' || $product_category_check == 'product_tag'))) {
            $where .= " AND 1==2 ";
    return $where;

function wcpv_get_user_role($user = null) {
    $user = $user ? new WP_User($user) : wp_get_current_user();
    return $user->roles ? $user->roles[0] : false;

Can I disable the plugin’s functionallity for menus only?

Our plugin hides the selected products, categories and tags from your whole website, eg. from the menus, the widgets and even from the theme you use, as long as the theme is using standard WordPress filters.

If, for some reason, want to exclude the menu, you can do so easily, by adding the function below in your functions.php:

add_action('init', 'wcpv_exclude_rules_from_menu', 1000);

function wcpv_exclude_rules_from_menu() {
    if (class_exists('WCPV_FRONTEND')) {
        $wcpv_frontent = WCPV_FRONTEND::get_instance();
        remove_filter('wp_get_nav_menu_items', array($wcpv_frontent, 'wcpv_nav_menu_categories_tags'), 10, 3);

Bear in mind, that if you click a menu item that leads to a hidden product or category page, it will returns the No products found of WooCommerce.

Can I use my own PHP conditions?

Yes you can, by using the relevant PHP code. You should have some PHP knowledge though, in order to do so.

Our plugin contains 6 available filters which you can use in functions.php. These are:

// Product rules filters
add_filter('wcpv_productids', 'wcpv_productids_custom');
add_filter('wcpv_products_visibility', 'wcpv_products_visibility_custom');

// Tag rules filters
add_filter('wcpv_tagids', 'wcpv_tagids_custom');
add_filter('wcpv_tags_visibility', 'wcpv_tags_visibility_custom');

// Category rules filters
add_filter('wcpv_categoryids', 'wcpv_categoryids_custom');
add_filter('wcpv_categories_visibility', 'wcpv_categories_visibility_custom');


Let say that you want to override all the category rules you have added for customer user roles, when a PHP condition is true, and hide 2 categories instead.

To do so, you can use this code in your functions.php:

$condition = true; // set your own condition through PHP here
if ((wcpv_get_user_role() == 'customer') && ($condition == true)) {
    add_filter('wcpv_categoryids',  'wcpv_categoryids_custom');
    add_filter('wcpv_categories_visibility',  'wcpv_categories_visibility_custom');

function wcpv_categoryids_custom($args) {
    return array(40,42); // An array of the category ids. You also can return an empty array.

function wcpv_categories_visibility_custom($args) { 
    return "exclude";  //exclude or include

// Helper function to get the current user role
function wcpv_get_user_role($user = null) {
    $user = $user ? new WP_User($user) : wp_get_current_user();
    return $user->roles ? $user->roles[0] : false;

Can i hide a product by user?

No, but as a workaround, you can create a separate user role for each of the users you want. For example create a User A role and assign it to the user you want, a User B role and assign to another, etc. You can user the User Role Editor plugin in order to create custom user roles.

Show more

Contact the author

This author provides limited support for this item through this item's comments.

Item support includes:

  • Availability of the author to answer questions
  • Answering technical questions about item’s features
  • Assistance with reported bugs and issues
  • Help with included 3rd party assets

However, item support does not include:

  • Customization services
  • Installation services

View the item support policy