
18 Cal.App.4th 1167 (1993)
22 Cal. Rptr.2d 779
THE PEOPLE, Plaintiff and Respondent,
v.
LUTHER MONREAL MANRIQUEZ, Defendant and Appellant.
Docket No. E011535.
Court of Appeals of California, Fourth District, Division Two.
August 18, 1993.
*1169 COUNSEL
Marilee Marshall, under appointment by the Court of Appeal, for Defendant and Appellant.
Daniel E. Lungren, Attorney General, George Williamson, Chief Assistant Attorney General, Gary W. Schons, Assistant Attorney General, John T. Swan and Rhonda L. Cartwright-Ladendorf, Deputy Attorneys General, for Plaintiff and Respondent.
[Opinion certified for partial publication.[*]]
OPINION
DABNEY, Acting P.J.
Defendant entered a plea of guilty to a charge of burglary (Pen. Code, § 459), in return for a promise to strike two 5-year enhancement allegations charged under Penal Code section 667.[1] It was also agreed that he would receive the upper term of six years, but that it would run concurrently with a four-year sentence recently imposed in a separate case, with full credits.
(1a) On this appeal, he asserts that he was confused when he pleaded guilty to burglary because he did not understand the elements of the offense and he thought he was pleading guilty to assault with a deadly weapon; thus, the trial court should have granted his motion to withdraw the plea. He also argues that the trial court violated the bargain when it imposed a restitution fine in the amount of $500.
We reject his attempt to challenge the validity of his plea, finding it barred by the absence of a certificate of probable cause. However, his contention that the restitution fine was improper is cognizable on appeal. We find it meritorious, and will direct that the judgment be modified accordingly.

STATEMENT OF FACTS
Evidence at the preliminary hearing indicated that defendant entered a residence, forcibly and without permission, and proceeded to administer a vicious beating to one of the persons present, striking him on the head with a bottle and then, when the victim fell to the floor unconscious, continuing to *1170 strike him with fists and feet. This evidence was relayed through a police officer, and represented the consistent statements of five witnesses.

DISCUSSION

A.
As effective at the time defendant entered his plea, was sentenced, and filed his notice of appeal, Penal Code section 1237.5 barred appeals from a judgment of conviction upon a guilty plea unless the trial court had executed a certificate of probable cause.[2] In this case, defendant applied for such a certificate, but the request was expressly denied by the trial court. (2a) (See fn. 3.) At the same time that he filed his opening brief, defendant sought mandamus from this court to compel the trial court to issue such a certificate (In re Brown (1973) 9 Cal.3d 679, 683 [108 Cal. Rptr. 801, 511 P.2d 1153]), but we denied the petition by order dated December 14, 1992.[3]
(1b) Penal code section 1237.5 applies to a proposed appellate attack on the validity of a guilty plea. (People v. Zamora (1991) 230 Cal. App.3d 1627, 1632 [282 Cal. Rptr. 100].) Although the requirements of the statute do not generally bar review of proceedings occurring subsequent to the plea (e.g., an attack on sentencing such as we discuss below in this case), a defendant may not avoid its effect by strategic maneuverings. Thus, where his essential attack is on the validity of his plea, he is subject to section 1237.5 even if he raises the question after the plea, by the vehicle of a motion to withdraw. (People v. Cotton (1991) 230 Cal. App.3d 1072, 1079 [284 Cal. Rptr. 757]; see also People v. Ribero (1971) 4 Cal.3d 55, 63-64 [92 Cal. Rptr. 692, 480 P.2d 308].)
*1171 (2b) The purpose of Penal Code section 1237.5  in all its variously amended forms  is to weed out frivolous or meritless appeals.[4] (People v. Breckenridge (1992) 5 Cal. App.4th 1096, 1101 [8 Cal. Rptr.2d 1].) (1c) From time to time, perhaps more or less wisely, courts proceed to the merits of a purported appeal simply to discourage any subsequent petition for habeas corpus based upon ineffective assistance of counsel, especially if counsel can be blamed for failing to obtain the certificate or the appellate issue goes to the competence of trial counsel. (See, e.g., People v. Ivester (1991) 235 Cal. App.3d 328, 336 [286 Cal. Rptr. 540]; People v. Everett, supra, 186 Cal. App.3d 274, 281.) We resist the temptation to do so. (See People v. Breckenridge, supra, at p. 1100; People v. Zamora, supra, 230 Cal. App.3d at p. 1634; People v. Ballard (1985) 174 Cal. App.3d 982, 988 [220 Cal. Rptr. 323].)

B.[*]
.... .... .... .... .... .... .... .

DISPOSITION
The judgment is modified to reflect the imposition of a restitution fine in the amount of $100. In all other respects, the judgment is affirmed.
Hollenhorst, J., and Timlin, J., concurred.
NOTES
[*]   Pursuant to California Rules of Court, rules 976(b) and 976.1, this opinion is certified for publication with the exception of part B.
[1]  Although the reporter's transcript does not indicate that the priors were to be stricken, this is implicit in the discussion of a six-year agreed term. The priors were in fact stricken at sentencing, along with a felony assault count related to the burglary.
[2]  The statute provides, in relevant part, "No appeal shall be taken by the defendant from a judgment of conviction upon a plea of guilty ... except where both of the following are met: ... (b) The trial court has executed and filed a certificate of probable cause for such appeal with the county clerk."
[3]  A certificate may be refused if the proposed grounds for appeal are clearly frivolous or vexatious; if this were not so, section 1237.5 would serve no purpose whatsoever. (Brown, at p. 686; People v. Everett (1986) 186 Cal. App.3d 274, 280-281 [230 Cal. Rptr. 604].) Obviously the trial court felt this to have been the case, and the record, as reviewed in connection with the writ proceeding, did not persuade us that this view was erroneous.

At least we may commend counsel for recognizing that defendant's primary issue on appeal required the certificate which the trial court refused to issue, and for seeking relief from this court. In the future, however, we suggest that such relief be sought, and obtained, before counsel researches, prepares, and files a brief raising an issue which turns out to be not cognizable.
[4]  Its efficacy  in any of its various forms  may be doubted.
[*]   See footnote, ante, page 1167.
