I was once thrown a curve ball of a question during a Bible class where a student referenced Proverbs 21:13 that says, "Whoever closes his ear to the cry of the poor will himself call out and not be answered."
Apparently he was bothered that God would ignore a plea for help simply because someone didn't give alms to a poor person.
Does God really ignore the prayers of people who don't take care for the poor? Moreover, does He ignore the prayers of anyone who might not walk in His way?
Looking at the passage in Proverbs 21:13, it's easy to miss the message by focusing on the wrong thing. What Solomon—and indirectly God—is really trying to put emphasis on here is the concern God has for the poor and in the importance of our contribution to alleviate the problems besetting society today. It urges us to get involved because God loves the poor—not because God won't answer our prayers if we don't.
Sometimes some Christians might view God in a transactional way, meaning we think that God will only do something if we do something for Him. The whole Old Testament shows us all these conditions that God asks us to follow to gain His blessing. And while God says that, we also see throughout the Bible that that's not always what happens.
Many times in the Old Testament (and even New) people called by God were not able to meet the standard that God set for them. But we also see how God blessed them anyway. The Israelites couldn't abide by God's written commands, but God still blessed them. Abraham doubted and chose to bear Ishmael, but God still gave him Isaac. David sinned against God multiple times, but God still made him one of the best kings. Peter rejected Jesus, yet God used him to be a driving force for the early church.
God is not a transactional God. He is a covenant-keeping God, meaning He remains faithful even when we aren't faithful. 2 Timothy 2:13 tells us this: "If we are faithless, he remains faithful— for he cannot deny himself."
Even when we miss the mark, God gives us grace. How is this possible? The only reason why God can freely give grace is because of what Jesus has done for us on the cross. His sacrifice has become a means for us to receive God's blessing and favour. All we have to do is believe in Jesus and the all-sufficiency of His finished work.
That's why every time we pray we always pray "in Jesus' name." God does not ignore our prayers. Yes, He might withhold and delay for our own good, but He always hears them. He listens to our cries and pleas and He makes a way even when there seems to be no way.