When challenging a conviction and/or sentence from a Virginia court, there are very strict deadlines for filing a habeas petition. Missing a deadline can be fatal to the case. Although some exceptions could apply, the exceptions are very narrow and difficult to establish.
Virginia's habeas statute, Code § 8.01-654, states, "A habeas corpus petition attacking a criminal conviction or sentence, except [for death penalty cases], shall be filed within two years from the date of final judgment in the trial court or within one year from either final disposition of the direct appeal in state court or the time for filing such appeal has expired, whichever is later." Va. Code § 8.01-654(A)(2).
In most cases, it is best to file within one year after the state appeal concludes or, if no appeal was pursued, within one year from the sentencing order, because there are a very strict deadlines for taking the habeas case into federal court if the state habeas petition is unsuccessful.
Thus, if the state habeas petition is filed within one year of the date that the direct appeal concluded in the Virginia Supreme Court or, if there was no appeal, within one year of the sentencing order, and the state habeas case is fully/properly pursued and exhausted in state court, the ability to file a habeas petition in federal court will be preserved. See 28 U.S.C. § 2244(d).
Please note that beyond filing deadlines, there are many more limitations on habeas cases.
A habeas petition may be filed even though a defendant entered a guilty plea, but the guilty plea will limit the available claims and make it very difficult to obtain habeas relief. See, for example, Hill v. Lockhart, 474 U.S. 52, 58 (1985).