InfoQuest Knowledgebase InfoQuest Knowledgebase

  • Home
  • Knowledgebase
    • Billing
    • Control Panel
    • Data Center
    • Databases
    • Domains
    • Email
    • FTP
    • Hosted Exchange
    • SSL Certificates
    • Virtual Private Servers
    • Webmail
    • Website Hosting
  • FAQ
  • Contact
  • Visit InfoQuest.com
Home / Website Hosting / Remove Post Category from WordPress Widgets

Remove Post Category from WordPress Widgets

In WordPress, if you want to remove a specific Post Category from the “Categories” widget you will first need to identify the ID of the specific category you wish to hide. You can locate the ID within the WordPress dashboard then by going to Posts > Categories. Hover your mouse over the Category in question then look in the bottom toolbar of your browser and you’ll see a URL string which will show the ID # of said Category. Once you have the Post Category ID (Note: In this example the ID is 1120, you’ll want to replace the number in the code below with the specific ID that applies to you) then you can add the following to your functions.php file:

/* Removes a specific Post Category from Category Widget */
function remove_widget_categories($args)
{
$exclude = “1120”;
$args[“exclude”] = $exclude;
return $args;
}
add_filter(“widget_categories_args”,”remove_widget_categories”);

If you want to hide a specific Post Category from the “Recent Posts” widget in WordPress, use the same method above in regards to finding the Post Category ID # then you can add the following to your functions.php file:

/* Removes Post Category from Recent Posts Widget */
add_filter(‘widget_posts_args’,’modify_widget’);
function modify_widget() {
$r = array( ‘category__not_in’ => ‘1120’);
return $r;
}

If you want to hide more than one Post Category from the “Recent Posts” widget in WordPress, identify the ID #s, then you can add the following to your functions.php file:

/* Remove Multiple Post Categories from Recent Posts Widget */
add_filter(‘widget_posts_args’,’modify_widget’);

function modify_widget() {
$r = array( ‘category__not_in’ => array(3, 4));
return $r;
}

categoryrecent postwidgetwordpress Website Hosting

Related Articles

  • Professional Services
  • iframe Dynamic Height Script
  • Where do I go to leave positive feedback for support?
  • Improving Website Performance

Knowledgebase Categories

  • 7Billing
  • 50Control Panel
  • 4Data Center
  • 4Databases
  • 12Domains
  • 58Email
  • 4FTP
  • 38Hosted Exchange
  • 7SSL Certificates
  • 25Virtual Private Servers
  • 5Webmail
  • 47Website Hosting

Most Helpful Articles

  • How to change WordPress siteURL to IP address using phpmyadmin (POA)
  • Remove index.php from WordPress URL (POA)
  • How To Setup An Archive Folder in Outlook for MAC (POA)
  • How to Redirect a Registered Domain (POA)
  • Share Exchange Outlook calendar on iOS devices (POA)
  • Changing the WordPress URL Path to web root “/” or another path (POA)
  • Where do I go to leave positive feedback for support?
Copyright © 2020 - InfoQuest Technologies, Inc.