How to Show/Hide Categories in WordPress (Ultimate Guide)
Do 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

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

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

Undress AI Tool
Undress images for free

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





On April 8, 2025, the three major U.S. stock index futures all rose. The specific situation is: 1. Dow futures rose 2%; 2. S&P 500 futures rose 1.78%; 3. Nasdaq futures rose 1.75%.

The exchange rate of Bitcoin to currencies of various countries is as follows: 1. USD: at 7:20 on April 9, the exchange rate is 10,152.53. 2. Domestic: at 2:2 on April 9, 1 Bitcoin = 149,688.2954 yuan. 3. Swedish Krona: At 12:30 on April 9, the exchange rate was 758,541.05.

Litecoin (LTC) price plummeted to $65 in early April, down nearly 7.5% in a week, echoing the plunge in the wider cryptocurrency market. The market crash caused billions of dollars to evaporate market value, Bitcoin (BTC) fell below $75,000, and altcoins generally fell. Macro factors such as rising U.S. Treasury yields and expected interest rates appear to intensify risk aversion in global markets. In addition, the large outflow of funds from Bitcoin spot ETFs further hits the confidence of retail investors and institutional investors. Against this backdrop, Litecoin is once again facing its long-term resistance level - the 200-week exponential moving average (EMA). The EMA had suppressed LTC prices in July 2023, when the price was close to $88. Historically, LTC and the

Binance made several adjustments to the margin collateral ratio of multi-currency combinations in April 2025. 1. Adjustment on April 4: In the multi-asset margin mode, FLOW and COMP have dropped from 80% to 70%, 1INCH has dropped from 70% to 65%, HOT and RVN have dropped from 70% to 60%, IOTX has dropped from 70% to 55%; in the unified account mode, CRV and UNI have dropped from 85% to 80%, ALGO has dropped from 85% to 75%, KSM has dropped from 80% to 70%, XTZ has dropped from 75% to 60%, and XEC has dropped from 70% to 55%. 2. Adjustment on April 11: In the combination margin mode, ICP dropped from 80% to 70%, SNX dropped from 80% to 65%, and MANA dropped from 75% to 6

After the USDT transfer address is incorrect, first confirm that the transfer has occurred, and then take measures according to the error type. 1. Confirm the transfer: view the transaction history, obtain and query the transaction hash value on the blockchain browser. 2. Take measures: If the address does not exist, wait for the funds to be returned or contact customer service; if it is an invalid address, contact customer service and seek professional help; if it is transferred to someone else, try to contact the payee or seek legal help.

Exchanges that support cross-chain transactions: 1. Binance, 2. Uniswap, 3. SushiSwap, 4. Curve Finance, 5. Thorchain, 6. 1inch Exchange, 7. DLN Trade, these platforms support multi-chain asset transactions through various technologies.

This article lists the ranking of APPs for legal platforms for virtual currency transactions, emphasizing that compliance is an important consideration for choosing a platform. The article recommends platforms such as Coinbase, Gemini, and Kraken, and reminds investors to study regulatory information and pay attention to security records when making choices. At the same time, the article emphasizes that virtual currency transactions are high-risk and investments should be cautious.

After ETH upgrade, novices should adopt the following strategies to avoid losses: 1. Do their homework and understand the basic knowledge and upgrade content of ETH; 2. Control positions, test the waters in small amounts and diversify investment; 3. Make a trading plan, clarify goals and set stop loss points; 4. Profil rationally and avoid emotional decision-making; 5. Choose a formal and reliable trading platform; 6. Consider long-term holding to avoid the impact of short-term fluctuations.
