admin管理员组文章数量:1279188
On my site I now have over 800 different product tags. When adding products it takes a very long time to scroll through them all to tag them. I tried to target specific product tags in CSS with display:none;
but it isn't working. Ideally I'd like to only show a specific 30 tags and omit the rest from the "choose the most used tag" box. This is what I have so far. I know I'm close. If anyone could offer some direction. It would be greatly appreciated
#tagcloud-product_tag > ul > li:nth-child(1) > a {display: none !important;}
On my site I now have over 800 different product tags. When adding products it takes a very long time to scroll through them all to tag them. I tried to target specific product tags in CSS with display:none;
but it isn't working. Ideally I'd like to only show a specific 30 tags and omit the rest from the "choose the most used tag" box. This is what I have so far. I know I'm close. If anyone could offer some direction. It would be greatly appreciated
#tagcloud-product_tag > ul > li:nth-child(1) > a {display: none !important;}
Share
Improve this question
edited Jan 20, 2019 at 16:27
butlerblog
5,1013 gold badges26 silver badges43 bronze badges
asked Jan 20, 2019 at 1:09
Suno360Suno360
332 bronze badges
1 Answer
Reset to default 2You can add a filter via the theme's functions.php file (I'd recommend you use a child-theme for customizations, but that's outside the scope of this question)
The following will limit the tag-cloud in the wp-admin backend to the first 5.
function tryme($tag_data){
$short_tag_data = array_slice($tag_data, 0, 5, true);
return $short_tag_data;
}
add_filter( 'wp_generate_tag_cloud_data', 'tryme' );
We can take this a step further & allow only specific tags...
function tryagain($tag_data){
$only_these_tags = array( 'keep-this-tag', 'and-this-tag' ); // A list of the slugs of the tags we want to keep
$short_tag_data = array(); // an empty placeholder for our new array
foreach ( $tag_data as $tag ) {
if ( in_array ( $tag['slug'], $only_these_tags ) ) {
array_push( $short_tag_data, $tag );
}
}
return $short_tag_data;
}
add_filter( 'wp_generate_tag_cloud_data', 'tryagain' );
本文标签: woocommerce offtopicHide certain tags on Product Edit tag cloud
版权声明:本文标题:woocommerce offtopic - Hide certain tags on Product Edit tag cloud 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741258080a2367073.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论