Nevertheless among the chief rulers also many believed on him; but because of the Pharisees they did not confess him, lest they should be put out of the synagogue: For they loved the praise of men more than the praise of God. (John 12:42-43)
A cursory reading of the Gospels can give one the impression that the religious leaders of Jesus’ day unanimously rejected the teachings of Jesus, but like all generalizations, that is not altogether true. Actually, many accepted His claims as true.
Take Nicodemus, for example. “There was a man of the Pharisees, named Nicodemus, a ruler of the Jews” (John 3:1). By this introduction, we know that Nicodemus was a Pharisee. “The Pharisees were an ancient Jewish group who laid the foundation for what would become rabbinic Judaism. The name, ‘Pharisee,’ likely comes from the Hebrew word prushim, meaning ‘separated ones,’ but it’s unclear what exactly this label signified. Some of the Pharisees’ biggest contributions to Judaism were: (1) Emphasizing the “oral tradition” (which they argued was equal to the written tradition of the Torah), (2) Extending Jewish practices into life outside the temple, (3) Instilling greater piety in “the common people,” (4) Promoting belief in the afterlife. Despite their influence on rabbinic Judaism and their prominence in the New Testament, the Pharisees are a notoriously difficult group to define. No ancient Jewish group referred to themselves as Pharisees. The label originated with people who didn’t belong to this group … Modern Christians tend to see the Pharisees in a negative light—mostly because the New Testament authors portray the Pharisees as legalistic and hypocritical. While that might describe their confrontations with Jesus and early Christians, it hardly tells the whole story of this important Jewish group.”
That John identifies Nicodemus as a “ruler of the Jews” suggests that he was a member of the Sanhedrin. The Sanhedrin was the supreme council and tribunal of the Jews during postexilic times headed by a High Priest and having religious, civil, and criminal jurisdiction. This is further confirmed when this group issued a warrant for Jesus’ arrest. After listening to Jesus’ teachings, the officers could not bring themselves to arrest Him. When questioned why they had returned empty-handed, “The officers answered, Never man spake like this man” (John 7:46). Nicodemus was in that group of the Sanhedrin, and he questioned their motives. “Doth our law judge any man, before it hear him, and know what he doeth?” (John 7:51).
Jesus further identified Nicodemus as “a master of Israel.” The Greek word translated as “master” is didaskalos meaning “an instructor (generally or specifically): – doctor, master, teacher.” Nicodemus knew the Scriptures, therefore he came to Jesus (by night) to hear directly from the source.
Nicodemus along with another named Pharisee came to believe in Jesus. The other was Joseph of Arimathaea who requested Jesus’ body for burial. John notes that Joseph was “a disciple of Jesus, but secretly for fear of the Jews.”  That he was a “disciple” indicates that he was a “student” of Jesus. He followed Jesus (secretly) for His teaching and Joseph, like Nicodemus, believed.
They were not the only ones. John records, in our verse above, that “among the chief rulers also many believed on him.” “Many” suggests more than just Nicodemus and Joseph. However, they kept their discipleship to themselves for fear, “lest they should be put out of the synagogue.” Earlier in his Gospel, John records Jesus’ healing of a man that was born blind. When the religious rulers questioned the man’s parents about their son’s healing, they responded, “we know not; or who hath opened his eyes, we know not: he is of age; ask him: he shall speak for himself. These words spake his parents, because they feared the Jews: for the Jews had agreed already, that if any man did confess that he was Christ, he should be put out of the synagogue” (John 9:21-22, emphasis mine). The fear of excommunication held powerful sway in keeping the religious in line, but perhaps it went deeper than that. John’s assessment makes it clear, “For they loved the praise of men more than the praise of God” (John 12:43).
After Jesus’ resurrection and ascension, more of these secret disciples came out of the closet. After Pentecost, Luke records, “And the word of God increased; and the number of the disciples multiplied in Jerusalem greatly; and a great company of the priests were obedient to the faith” (Acts 6:7, emphasis mine). No matter how the elites tried to spin it, the fact of Jesus’ resurrection could not be denied except for the willfully ignorant.
Are you a secret believer, an undercover disciple, an incognito follower of Christ? Do you fear being cast out of the “synagogue” of your social or peer group? Do you love “the praise of men more than the praise of God”? If so, Jesus said, “Whosoever therefore shall be ashamed of me and of my words in this adulterous and sinful generation; of him also shall the Son of man be ashamed, when he cometh in the glory of his Father with the holy angels” (Mark 8:38). If Jesus lived in an “adulterous and sinful generation” think how much truer that is for our generation! Jesus’ return is very near. You do not want Him to be ashamed of you when He comes? Don’t be a secret believer. Instead, adopt Paul’s attitude. He said, “For I am not ashamed of the gospel of Christ: for it is the power of God unto salvation to every one that believeth; to the Jew first, and also to the Greek” (Romans 1:16).
 “Who Were the Pharisees? The Beginner’s Guide” — https://overviewbible.com/pharisees/