Notice that his scathing attack is against both the Pharisees and Sadducees: The Pharisees had public power because they tended to be successful people in private life. In spite of this, they also had the admiration of the people. The Sadducees were largely from the priesthood and thus controlled the Temple. Consequently, they pretty much controlled the religious life of the people. Yet, because they also tended to be wealthy but haughty in disposition, the feelings of the people were prejudiced against them.
John courageously confronts the establishment's leadership. His was an unpopular message of judgment aimed directly at the powerful, and they did not take kindly to what he said. "And when all the people heard Him, even the tax collectors justified God, having been baptized with the baptism of John. But the Pharisees and lawyers rejected the counsel of God for themselves, not having been baptized by him" (Luke 7:29-30).
Matthew 21:32 confirms John's rejection when Jesus speaks to the chief priests and elders at the Temple: "For John came to you in the way of righteousness, and you did not believe him; but tax collectors and harlots believed him; and when you saw it, you did not afterward relent and believe him." The powerful knew John was speaking about them, so in disdainful anger, they rejected him, while the publicans and harlots accepted his teaching.
John W. Ritenbaugh
Elijah and John the Baptist