WPTT / WPThemeReview

PHP_CodeSniffer rules (sniffs) to enforce WordPress theme review coding conventions
MIT License
209 stars 37 forks source link

[New Sniff] Check for removal of admin pages #17

Open jrfnl opened 8 years ago

jrfnl commented 8 years ago

Rule:

Removal of WP admin pages is not allowed.

The exception would be a child theme removing a theme admin submenu page added by the parent theme.

Ref: https://github.com/WPTRT/WordPress-Coding-Standards/issues/12#issuecomment-231783316

Theme check file covering this rule:

n/a

Decision needed:

This is currently not in the handbook as a rule. Should it be one ?

Notes for implementation:
jrfnl commented 6 years ago

Discussed in the meeting of May 31st, let's add this.

jrfnl commented 6 years ago

To create this sniff, I need some more information about the WP Core admin pages which are not supposed to be removed.

The question is basically: which submenu items are allowed to be removed ? Answers I can think of:

justintadlock commented 6 years ago

Essentially, the only admin pages allowed to be removed would be custom Appearance submenu items created by a parent theme and removed by a child theme. I can't think of any others we allow to be removed. I'm not even sure that there's a child theme that does this in the directory. The situation would be rare.

grappler commented 6 years ago

I would go with

Only admin pages within the Themes submenu and of those, not the known core ones (themes, customizer and its variants, widgets, menus, theme-editor).

I agree with Justin.

jrfnl commented 6 years ago

Thanks for the feedback. I have the sniff nearly ready already, but won't be able to get back to it until the weekend.

dingo-d commented 5 years ago

@jrfnl is this a different sniff from the forbidden functions one?

jrfnl commented 5 years ago

Yes it is and a lot more complicated one. Themes can remove admin pages from, for instance, a parent theme, but they are not allowed to remove WP Core admin pages, so there is a lot more involved in that.

I worked on it last year and it's quite tricky. I'd need to have a good look again to see where I got stuck.

dingo-d commented 4 years ago

I've removed the input/decision needed, as we know what is and isn't allowed.