WPThemeReview icon indicating copy to clipboard operation
WPThemeReview copied to clipboard

Metadata sniffs

Open justintadlock opened this issue 7 years ago • 6 comments

Warning:

We need sniffs that check metadata. Currently, the theme review team allows themes to have metadata if it is presentational in nature. Some common examples:

  • Sidebar position
  • Background color
  • Layout

However, we do not allow metadata that is non-presentational in nature. Some common examples:

  • Video URL
  • Gallery shortcode
  • User-specific social URLs

This would probably need to be an warning-level notice because we wouldn't be able to know whether the meta is presentational or not via code.

Code would need to check functions:

  • add_metadata()
  • update_metadata()
  • add_post_meta()
  • update_post_meta()
  • add_user_meta()
  • update_user_meta()
  • add_comment_meta()
  • update_comment_meta()

We could probably check for the delete_*_meta() functions too, but this is probably unnecessary.

Hooks to check:

  • attachment_fields_to_edit
  • attachment_fields_to_save

Error:

One area we could absolutely check for non-presentational metadata is if a theme has a filter on user_contactmethods. This is only used for adding contact methods to the user profile, which would not be presentational.

justintadlock avatar Apr 13 '17 19:04 justintadlock

And how would this work if the theme integrates a library for that purpose? Is it allowed because the theme isn't doing the work? Or is the library then part of the theme that shouldn't be doing it either?

joyously avatar Apr 13 '17 20:04 joyously

A library included in the theme is still a part of the theme. So, it doesn't matter. The library is irrelevant in this case.

justintadlock avatar Apr 14 '17 18:04 justintadlock

I suppose we should do the same for custom widgets.

carolinan avatar May 02 '17 18:05 carolinan

Let allow non-presentational metadata.

rinkuyadav999 avatar May 03 '17 15:05 rinkuyadav999

There is a branch for this issue-136-non-presentational-meta but it needs testing. Should this not be combined with other restricted functions?

carolinan avatar May 05 '17 03:05 carolinan

Resolution from the triage: we should add this as a sniff and add info into the requirements. Also, see if there is a chapter for this in the Theme developers handbook and add a chapter there if there isn't.

dingo-d avatar Mar 11 '20 16:03 dingo-d