{"id":316,"date":"2018-01-05T08:49:53","date_gmt":"2018-01-05T08:49:53","guid":{"rendered":"https:\/\/www.templatesell.com\/blog\/?p=316"},"modified":"2018-01-05T09:39:18","modified_gmt":"2018-01-05T09:39:18","slug":"limit-number-tags-widget","status":"publish","type":"post","link":"https:\/\/templatesell.com\/blog\/limit-number-tags-widget\/","title":{"rendered":"Limit the Number of Tags in WordPress Tag Cloud Widget"},"content":{"rendered":"<p>If you are looking to limit the number of tags in WordPress tag cloud widget, this blog post is very helpful for you. Tag cloud widget is WordPress core widget which helps you to show the tags on your WordPress website. The tag is one of the predefined taxonomy of WordPress where users can add their own tag like category via Post section of admin dashboard. Users can add the Tags while creating the post as well.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-317 size-full\" src=\"https:\/\/www.templatesell.com\/blog\/wp-content\/uploads\/2018\/01\/tag-cloud.png\" alt=\"Tags Widget\" width=\"557\" height=\"338\" srcset=\"https:\/\/templatesell.com\/blog\/wp-content\/uploads\/2018\/01\/tag-cloud.png 557w, https:\/\/templatesell.com\/blog\/wp-content\/uploads\/2018\/01\/tag-cloud-300x182.png 300w\" sizes=\"auto, (max-width: 557px) 100vw, 557px\" \/><\/p>\n<p>If you are using Tag Cloud widget to show the available Tags on your WordPress website and due to a large number of tags your site looks weird and messy you can easily limit the number of tags to display there.<\/p>\n<h4>Follow the below-listed method to limit the number of tags,<\/h4>\n<ol>\n<li>Open your theme `functions.php` file (Make sure you are editing activated theme file)<\/li>\n<li>Paste the below code at the end of your functions.php file<\/li>\n<li>Save the file.<\/li>\n<\/ol>\n<pre><code>\/\/Register tag cloud filter callback\r\nadd_filter('widget_tag_cloud_args', 'tag_widget_limit');\r\n\/\/Limit number of tags inside widget\r\nfunction tag_widget_limit($args){\r\n\/\/Check if taxonomy option inside widget is set to tags\r\nif(isset($args['taxonomy']) &amp;&amp; $args['taxonomy'] == 'post_tag'){\r\n$args['number'] = 10; \/\/Limit number of tags\r\n}\r\nreturn $args;\r\n}<\/code><\/pre>\n<p>You can change the number on the section<code>\/\/Limit number of tags<\/code> and check on the front view. Hope this code helps you to limit the number of Tags on your website. We recommend you to use Child Theme for such theme customization. Check this blog to know the <a href=\"https:\/\/www.templatesell.com\/blog\/child-themes-and-its-usage\/\">Importance of Child Theme<\/a>.<\/p>\n<h4>WooCommerce Product Tag Cloud<\/h4>\n<p>If you want to change the number of tags on WooCommerce Product Tag Cloud Widget, as per the above method, add the below code snippit on functions.php file,<\/p>\n<pre><code>\r\nfunction custom_woocommerce_tag_cloud_widget() {\r\n    $args = array(\r\n        'number' => 5,\r\n        'taxonomy' => 'product_tag'\r\n    );\r\n    return $args;\r\n}\r\nadd_filter( 'woocommerce_product_tag_cloud_widget_args', 'custom_woocommerce_tag_cloud_widget' );\r\n<\/code><\/pre>\n<p>Hope this post is very helpful, please comment your feedback or suggestion in the comment section below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are looking to limit the number of tags in WordPress tag cloud widget, this blog post is very helpful for you. Tag cloud widget is WordPress core widget which helps you to show the tags on your WordPress website. The tag is one of the predefined taxonomy of WordPress where users can add [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[6],"tags":[31],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-tips-and-tutorials","tag-tags"],"blocksy_meta":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9LLEg-56","_links":{"self":[{"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":0,"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"wp:attachment":[{"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/templatesell.com\/blog\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}