How to Show/Hide Categories in WordPress (Ultimate Guide)
Apr 20, 2025 am 06:45 AMDo you want to show or hide a category based on whether there are posts in WordPress?
By default, WordPress does not display empty categories. However, sometimes you might want to display them even if they have no content.
In this article, we will show you some simple ways to hide or show categories in WordPress, depending on whether there are any posts in that category.
Why Hide or Show Empty Category in WordPress
WordPress comes with two default taxonomy: Category and Tag. Tags are used for specific topics of articles, while categories have broader meanings.
Many website owners use categories to create different sections for their WordPress websites.
For example, at WPBeginner we have different categories covering the main parts of the overall content.
By default, WordPress does not display empty categories in the category widgets and category lists.
However, some website owners may still need to display empty categories on their WordPress blog.
For example, if they are developing custom theme designs, or they just want the user to see empty categories and fill them with user-generated content.
Similarly, some websites may want to hide certain categories without any posts while still showing other empty categories.
In this guide, we will show you how to easily hide or display empty categories in WordPress.
Show empty categories in WordPress
WordPress now uses widget blocks to replace old classic widgets. This makes it more difficult to change the parameters used by the category block to list the categories.
To achieve the result we want, we need to write our own code to list the categories and then display it with the shortcode.
For this tutorial, you need to add some code to your WordPress website. If you haven't done this before, see our guide on how to add custom code snippets in WordPress.
First, you need to add the following code to the functions.php file of the theme or add code snippets using WPCode (recommended).
For detailed instructions, see our guide on how to easily add custom code in WordPress.
This code simply uses our own parameters to list the categories, and one of these parameters is to change the hide_empty category parameter.
After that, you can display the custom category by adding the shortcode block to the widget area and then adding the shortcode in [custom_categories_list].
Don't forget to update your widget settings once you're done.
You can then visit your website to see the categories that are running.
Hide specific categories in the category list
Again, you can use the same method to exclude categories that you do not want to be included in the category list.
Just modify the above code as follows:
All in One SEO for WordPress is the best WordPress SEO plugin on the market that allows you to easily control how your website looks in search results.
After installing the plugin, you will see a setup wizard. This is self-explanatory, but if you need help, follow our guide on setting up All in One SEO.
Next, you need to visit the Posts ? Categories page and click the Edit link below the category you want to exclude.
On the Edit Category page, you need to scroll down to the All-in-One SEO section.
Then, switch to the Advanced tab.
From here, you need to turn off the “Default Settings” option next to the robot settings. You will now see the option to tell search engines not to track and index this category.
When you are done, don't forget to click the "Update" button to save your settings.
All-in-one SEO will now begin telling search engines not to index or follow that particular page.
Note: Posts submitted under this category may still be indexed by search engines and appear in search results.
We hope this article helps you understand how to hide or display empty categories in WordPress. You may also want to check out our guide on how to show personalized content to different users in WordPress, and the best WordPress plugins our experts have picked for business websites.
The above is the detailed content of How to Show/Hide Categories in WordPress (Ultimate Guide). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP does not directly perform AI image processing, but integrates through APIs, because it is good at web development rather than computing-intensive tasks. API integration can achieve professional division of labor, reduce costs, and improve efficiency; 2. Integrating key technologies include using Guzzle or cURL to send HTTP requests, JSON data encoding and decoding, API key security authentication, asynchronous queue processing time-consuming tasks, robust error handling and retry mechanism, image storage and display; 3. Common challenges include API cost out of control, uncontrollable generation results, poor user experience, security risks and difficult data management. The response strategies are setting user quotas and caches, providing propt guidance and multi-picture selection, asynchronous notifications and progress prompts, key environment variable storage and content audit, and cloud storage.

The real use of battle royale in the dual currency system has not yet happened. Conclusion In August 2023, the MakerDAO ecological lending protocol Spark gave an annualized return of $DAI8%. Then Sun Chi entered in batches, investing a total of 230,000 $stETH, accounting for more than 15% of Spark's deposits, forcing MakerDAO to make an emergency proposal to lower the interest rate to 5%. MakerDAO's original intention was to "subsidize" the usage rate of $DAI, almost becoming Justin Sun's Solo Yield. July 2025, Ethe

Directory What is Bitcoin? How does Bitcoin work? Why is Bitcoin not scalable? What is BIP (Bitcoin Improvement Proposal)? What is Bitcoin Taproot Update? Pay to Taproot (P2TR): Benefits of Taproot: Space-saving privacy advantages Security upgrade conclusion: ?Bitcoin is the first digital currency that can send and receive funds without using a third party. Since Bitcoin is software, like any other software, it needs updates and bug fixes. Bitcoin Taproot is such an update that introduces new features to Bitcoin. Cryptocurrency is a hot topic now. People have been talking about it for years, but now with prices rising rapidly, suddenly everyone decides to join and invest in them. Message

What is Treehouse(TREE)? How does Treehouse (TREE) work? Treehouse Products tETHDOR - Decentralized Quotation Rate GoNuts Points System Treehouse Highlights TREE Tokens and Token Economics Overview of the Third Quarter of 2025 Roadmap Development Team, Investors and Partners Treehouse Founding Team Investment Fund Partner Summary As DeFi continues to expand, the demand for fixed income products is growing, and its role is similar to the role of bonds in traditional financial markets. However, building on blockchain

Domestic purchase of Bitcoin must be carried out through compliance channels, such as Hong Kong licensed exchanges or international compliance platforms; 2. Complete real-name authentication after registration, submit ID documents and address proof and perform facial recognition; 3. Prepare legal currency and recharge it to the trading account through bank transfer or electronic payment; 4. Log in to the platform to select Bitcoin trading pairs, set limit orders or market orders to complete the transaction; 5. Pay attention to market fluctuations and platform security, enable dual certification and comply with domestic regulatory policies; overall, investors should operate cautiously under the premise of compliance and participate in Bitcoin investment rationally.

This article explores in-depth two main strategies for implementing call hold (Hold) and recovery (Un-hold) in Twilio voice calls. First of all, it is recommended to use the Twilio Conference feature to easily control the retention and recovery of calls by updating the resources of meeting participants, and to configure the retention of music. Second, for more complex independent call leg scenarios, the article explains how to manage call state through carefully designed TwiML streams (such as using, and) to avoid accidental disconnection of non-holding legs and enable call reconnection.
![[2025 Latest] Bitcoin real-time market APP rankings, these 5 are the most accurate and fastest!](https://img.php.cn/upload/article/000/000/083/6888925c6d544409.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
The five most popular Bitcoin market APPs in 2025 are: 1. Binance, whose data comes directly from the world's largest trading pool, updated in milliseconds, suitable for professional traders; 2. Ouyi (OKX), accurate market conditions and smooth APP experience, the first choice for mobile users; 3. Huobi (HTX), a veteran exchange, stable technology, reliable mainstream currency data; 4. Gate.io (Sesame Open Door), rich currency types, is a powerful tool for mining the early market of altcoins; 5. CoinMarketCap, a world-renowned data aggregation platform, integrates data from hundreds of exchanges, provides weighted average reference prices, authoritative and fair.

The Hong Kong government restarted the "Capital Investor Entry Plan", and for the first time included cryptocurrencies in the investment scope, clearly attracting high-net-worth individuals around the world with the investment threshold of HK$30 million; of which HK$3 million must be invested in the Innovation and Technology Investment Portfolio, and HK$27 million can be used to invest in stocks, bonds, funds, non-residential real estate or virtual assets; 1. Applicants can invest all HK$27 million in cryptocurrencies traded on platforms such as Ethereum and the Hong Kong Securities Regulatory Commission; 2. The typical combination is HK$27 million Ethereum plus HK$3 million Innovation and Technology Investment, meeting the application conditions; this move marks Hong Kong's active construction of Web3 and virtual asset centers to promote the digital economy and talent aggregation.
