The very first thing to know is that you should always get professional legal advice before considering a bankruptcy filing or other legal mater.
That said, there are at least two (2) types of bankruptcy protection homeowners can file for — only one of which can generally be used to halt foreclosure proceedings.
A Chapter 7 filing can be a path to a total discharge of personal debt obligations. As the bankrupcy court (and your mortgage company) will assume that your Ch. 7 filiing means you don’t plan to repay your debts, these filings generally do not stop the foreclosure process.
Chapter 13 protection opens a path for the consumer to “restructure” their debts, mortgage arrears (past dues) included and can usually protect you from foreclosure. Together with your attorney, the bankruptcy “trustee” (US DoJ) helps you restructure your secured debts (auto and mortgage), over what is usually a 3 – 5 year period. Later in the bankruptcy proceedings a judge can “discharge” your unsecured debts as would occur in a chapter 7 case.
If you are considering a bankruptcy filing, accept legal advice from no one other than a practicing attorney!