0

Can I remove WooCommerce specific product categories from shop managers, so that they can publish products only in some specific categories.

I tried this, but it's not working.

$user = wp_get_current_user();
if (!current_user_can('activate_plugins')) {
  add_action('wp_head', 'removeCategories', 100);
  function removeCategories()
  {
    echo "<style>#product_cat-23{display: none !important;}</style>";
  }
}

1 Answer 1

1
$user = wp_get_current_user();
if (!current_user_can('activate_plugins')) {
  add_action('admin_head', 'removeCategories', 100);
  function removeCategories()
  {
    echo "<style>#product_cat-23{display: none !important;}</style>";
  }
}

It's admin_head for admin UI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.