CHICAGO — When Chase Headley was going through the worst start of his career, Carlos Beltran pulled him aside more than once.

“He talked to me a lot in April and was saying, ‘Hey, man, I was doing the same thing last year,’ I was basically going through the same thing,’ ” Headley said before Wednesday night’s game against the White Sox.

Though it’s been largely forgotten because of what’s followed — including the 39-year-old Beltran being named to his ninth All-Star game Tuesday based on a stellar first half — the rightfielder indeed went through something quite similar.

Beltran had a .162/.216/.265 slash line in April 2015, with zero homers and seven RBIs, numbers that had more than a few people declaring his career done.

Those numbers are not all that much different than Headley’s April 2016 when he slashed .150/.268/.150, with zero homers and two RBIs.

And though Headley’s turnaround hasn’t been as dramatic as Beltran’s in 2015 — Beltran slashed .295/.357/.505 with 19 homers and 60 RBIs the last five months of the season — there has been a turnaround nonetheless.

Entering Wednesday night, Headley had a .287/.352/.452 slash line since April, with seven homers and 23 RBIs.

advertisement | advertise on newsday

And Headley said Beltran’s contributions to that were more than simple positive reinforcement.

“We talked a lot and he gave me a couple of ideas that ultimately were part of the solution,” Headley said.

Beltran has talked about wanting to coach or manage when his career is over and Headley experienced it first-hand.

“He’s incredibly knowledgeable about the hitting discipline,” Headley said. “He loves to talk about it. He’s there [at the cages watching] constantly.”

Headley said Beltran noticed a small but significant flaw in his swing.

Yankees videos

“My shoulders were creating my swing rather than my hands,” Headley said. “I knew that they were, but I couldn’t get the feel that I was looking for to correct that. One thing that he told me was ‘shoulder to shoulder’ with my head so you’re watching the ball as you swing, instead of rotation off. That allowed me to keep the shoulder in.”

He added: “It sounds like that’s something so easy to do but when you’ve gotten in a habit and can’t really feel the feeling your looking for, just having him give me something that I could focus on that was so easy and allowed me to accomplish what I was looking to accomplish . . . that’s what good hitting coaches, or coaches of anything, is figure out a way to make it simple to get it done. He’s got a gift as far as understanding hitting and teaching it.”

Headley’s story is among the many reasons, as happy as Yankees players were for Andrew Miller and Dellin Betances making the AL All-Star team, there was an extra dose of excitement for Beltran’s achievement.

“He’s a great teammate,” CC Sabathia said. “He helps the young guys out, young and old guys out. It’s just awesome he’s getting a chance to be recognized for what he’s done for us.”

And, of course, there’s been the production.

advertisement | advertise on newsday

After going 3-for-5 in Tuesday night’s game, Beltran brought a .302/.341/.571 slash line into Wednesday. He leads the Yankees in slugging, home runs (19) and RBIs (54).

“What he’s done this year, you could argue he can be [an All-Star] starter,” Betances said. “For him to do it at this stage of his career . . . I can’t wait to share that moment with him.”

Said Sabathia: “He’s been our MVP. He shows up every day, ready to work, gets big hits for us. He does everything you ask of him.”