It can often be a good idea to buy a stock when Wall Street is negative about it. The problem is that investors are usually negative for good reasons, which means you need to be pretty sure a company can muddle through whatever has the market worried.

Right now, Hormel Foods (HRL 0.14%) and Realty Income (O -0.17%) are both in the doghouse, but there's good reason to think that each can overcome their near-term challenges. For long-term dividend investors, this provides an excellent buying opportunity today.

Hormel has lived through hard times before

With 57 years of annual dividend increases behind it, Hormel Foods has clearly had to muddle through good periods and bad ones. Today is one of the bad ones. And yet, even in the face of difficulty, this Dividend King continues to increase its dividend, rewarding investors for sticking around. The latest hike, meanwhile, wasn't just a token, it was roughly 6%, which is a pretty solid figure.

Still, it's worth looking at the headwinds the food maker is facing today. Inflation has been increasing the company's costs, but it hasn't been able to push prices through to consumers as well as many of its peers. So profitability is under pressure. The avian flu has disrupted its turkey operations, limiting its ability to supply retailers with Jennie-O Turkey products. Recently acquired Planters has been attempting a turnaround in a tough market for nuts. And sales in China have been weaker than hoped as that country opens back up after coronavirus-related lockdowns.

All these negatives at once is not good. However, it has pushed the yield up to nearly 3%, which is historically high for Hormel. That suggests that the stock is cheap today. Meanwhile, all the problems listed above are likely to be temporary (some are already starting to turn for the better) for a company that has lived through the Great Recession, the 2000 tech bust, and the hyperinflation of the 1970s without missing a beat when it comes to dividend growth. 

HRL Chart

HRL data by YCharts

Yes, Hormel is dealing with headwinds. But if you are looking for a reliable passive income stock to hold for the long term, now looks like a unique opportunity to add Hormel to your portfolio.

Realty Income's size gives it an edge

The big problem today for Realty Income is that, as a real estate investment trust (REIT), it is designed to pass income on to shareholders. That puts the company in competition with other yield investments, like CDs. With interest rates rising sharply over the past year or so, competing options have become more attractive, and Realty Income's stock price has fallen to compensate for the added risk of owning a stock. Growth has also become more costly, since REITs tend to fund acquisitions with a combination of stock and bonds. 

Yet Realty Income is a standout in the REIT space. It is the largest net lease landlord, which means its tenants are responsible for most property level operating costs. It has increased its dividend annually for 29 consecutive years. It has an investment-grade-rated balance sheet. And its portfolio is globally diversified. There are a lot of things to like.

But it is worth taking a second look at the REIT's size. With a market capitalization of nearly $40 billion, it is a giant relative to its closest net lease peers, the second largest of which is less than half that size. This, along with its strong financial position, gives Realty Income the wherewithal to profitably take on massive deals that others simply couldn't get done because they lack the same access to capital markets for raising cash. That remains as true in bad markets as it is in good ones.

O Chart

O data by YCharts

Realty Income's dividend yield of 5.5% or so isn't the highest it has ever been, but it is on the high side of the range over the past decade. Given its successful history and size advantage in a maturing industry where size increasingly matters (at least partly thanks to rising rates), long-term income investors should probably take a closer look.

Investing when others are fearful

It won't be easy to pull the trigger on Hormel or Realty Income given both are dealing with noticeable headwinds. But if history is any guide, this pair of dividend stocks will find a way to muddle through while continuing to reward investors well for sticking around. If you think in decades (or longer), now is the time to dig into both of these reliable passive income stocks.