Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To How To Hide A Specific Category From Showing Inside Post In WordPress
#1


Hello guy Today am going to be teaching you how to hide a specific category from showing up in post section.


Many having been asking

I have a category about the catalog, news1 Which I use to get a post on the main page. The problem is that I don't want the news1 category name to appear in these posts, but I want other categories to be displayed.

How can I do this?

Login to your wordpress site 
Click on Appearance 
Editor 
Function.php

Past the below code in your function.php


add_filter( 'get_the_categories', function ( $categories, $id ) {
foreach ( $categories as $i => $term ) {
if ( 253 == $term->term_id ) {
unset
( $categories[$i] );
}
}
return $categories;
}, 10, 2 );




Change the { if ( 253  (253) to your category id you wish to hide 

How to find category id in wordpress 

Click On Posts > Categories >
Find the one you want to hide, and click on the category on the url box scroll to the id and copy the id 
Or 
Press and hold the text you will see the category id 

To Purchase Credit Click here , For how to make money on Sologet forum Click here 

HIRE ME FOR WEBSITE DESIGNING USE THE PM BUTTON TO SEND ME MESSAGE

There is love in sharing
  


Messages In This Thread
How To Hide A Specific Category From Showing Inside Post In WordPress - by Kingsolomon - 10-23-2019, 07:43 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  HOW TO How to Create Backup and Restore Your WordPress Website Zenmarc 0 83 09-16-2019, 04:18 PM
Last Post: Zenmarc
  MUST READ List of Best WordPress Themes Zenmarc 0 186 08-26-2019, 02:06 PM
Last Post: Zenmarc
  HOW TO How to Remove URL / Website Field from WordPress Comment Form Kingsolomon 0 420 06-24-2019, 12:13 PM
Last Post: Kingsolomon
  How To Show WordPress Post View Count Without A Plugin Kingsolomon 4 1,068 04-28-2019, 06:20 AM
Last Post: Kingsolomon
  Problems with seekhype theme Frizzy 0 381 04-02-2019, 12:12 PM
Last Post: Frizzy

Forum Jump:


Users browsing this thread:
1 Guest(s)

How To Hide A Specific Category From Showing Inside Post In WordPress00