Open jrfnl opened 8 years ago
Discussed in the meeting of May 31st, let's add this.
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:
Themes
submenu and of those, not the known core ones (themes, customizer and its variants, widgets, menus, theme-editor).Themes
submenu + the Options
submenu, again with the exception of the known core onesEssentially, 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.
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.
Thanks for the feedback. I have the sniff nearly ready already, but won't be able to get back to it until the weekend.
@jrfnl is this a different sniff from the forbidden functions one?
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.
I've removed the input/decision needed, as we know what is and isn't allowed.
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:
remove_menu_page()
and forbid this.remove_submenu_page()
and only forbid this if one of a known list of WP Core admin pages is being removedTo do: