PLEASE UPDATE YOUR BROWSER

1 Reason Insurance (715)598-9924

Leadership Through Service

  • About
    • Meet the Insurance Agents of 1 Reason Insurance
    • Partner Insurance Companies
  • Personal Insurance
    • Car Insurance Quote for Personal Auto
    • Boat Insurance
    • Home Owners Insurance Application
    • Life Insurance Quotes
    • Motorcycle Insurance
    • Personal Umbrella Insurance
    • Renters Insurance
    • RV Camper Insurance
    • Snowmobile Insurance
  • Business Insurance
    • Commercial Auto Insurance
    • What is General Liability Insurance
    • Rental or Vacant Properties
    • Workers Compensation in Wisconsin
  • Blog
  • Contact 1 Reason Insurance
    • Contribute As Guest Author
Home > Business Marketing > Webhosting > Removing Categories From Search Results

Removing Categories From Search Results

Posted on: August 28, 2021 By: robert

I have content I want on my website, for example, insurance and real estate news, albeit I don’t necessarily want it displayed in search results for people who are not interested in news, albeit want advice on insurance and/or real estate written by someone related to 1 Reason Insurance directly.

The following code was added to the child theme and removes the categories from the search results. It took all of maybe 10 minutes to implement.

// remove categories from search added by Robert W 8/28/2021
function wcs_exclude_category_search( $query ) {
if ( is_admin() || ! $query->is_main_query() )
return;

if ( $query->is_search ) {
$query->set( ‘cat’, ‘-302, -65’ );
}

}
add_action( ‘pre_get_posts’, ‘wcs_exclude_category_search’, 1 );

In the line of $query->set (cat…..-302, -65 is the category numbers (can lookup using Post-> category to find) and separate categories by comma.

Comments

comments

Categories: Webhosting

1Reason Agencies

What clients have to say:

Mike T. "I started a business last year and Robert responded to my inquiries immediately, and was extremely helpful and knowledgeable as to the type of insurance coverages I would need to get started. Now its been a year and he now carries All of my coverages! Absolutely the most hands on agent I've ever worked with but hands down the friendliest! I can call him anytime and never feel rushed and not only that but he responded while on a family vacation. I believe in relationships in business and so does Robert by the way he treats his customers. I have a true friend in the business, thank you Robert!"


Lynn R. "Bob is very knowledgeable and has always done a great job explaining different aspects of coverage. He is very accessible and looks out for what is best for the consumer. We highly recommend him!


Justin T. "Excellent agent, always available for answers to insurance related questions. Bob, is the person most people strive to become. Without a doubt, a great person!"


Sebastian T. "I can not begin to tell you how pleased I am with 1 Reason Insurance ! Their responding services is friendly and complete. For the services my company offers to the public it is sure nice to know that we are covered for a reasonable fee. Just having (1 R I ) 1 Reason Insurance there is such piece of mind ! Their insurance plans are strait to the point and easy to understand.
Thanks for the great service 1 Reason Insurance !"


Jeff H. "Very nice and cares about the customer! He was literally the reason why i chose him over other companies for my insurance"

Categories

  • Bonds
    • Performance Bond
  • Bookkeeping
    • Business Taxes
  • Business Marketing
    • Webhosting
  • Car Insurance
  • Commercial Auto
  • Commercial Insurance
  • Court Cases
  • Cyber Liability Insurance
  • Employment Opportunities
  • Employment Practices
  • Flood Insurance
  • Home Ownership
  • Homeowner's Insurance
  • Insurance Companies
    • Insurance News
  • Insurance Terms
  • Investing
    • Finance & Insurance News
  • Life Insurance
  • Non Emergency Medical Transportation
  • Payroll
  • Pinewood Derby
  • Professional Liability / E&O
  • Real Estate News
  • Rental Property Insurance
  • Retirement & Estate Planning
  • RV Insurance
  • Starting A Business
  • Stock Dividends
  • SuiteCRM Insurance CRM
  • Taxes
  • Tips & Advice
  • Travel
  • Uncategorized
  • Worker's Compensation

Recent Posts

  • Greystone Provides $47.3 Million FHA/HUD Loan to Refinance Multifamily Property in Middlesex, New Jersey
  • Scottsdale Fashion Square Announces Naming Rights Opportunity of its Newly Redeveloped Signature Gathering Space and Social Hub
  • UMH PROPERTIES, INC. WILL HOST SECOND QUARTER 2026 FINANCIAL RESULTS WEBCAST AND CONFERENCE CALL
  • LGI Homes Celebrates Grand Opening of Chima Ranch in Yuba City, California
  • Brown & Brown, Inc. included on the 2026 Best Workplaces™ in Financial Services & Insurance and Best Workplaces™ for Mental Health Lists in Canada
  • Boomer Benefits Unveils Updated Medicare Plan G Reviews Guide
  • Shepherd Insurance Expands Florida Footprint with Addition of Responsive Insurance
  • Orion180 Launches FLEX Home Insurance in Colorado