0

Is there a way to find/list the current custom fields/meta used for a theme?

For example, let's say I'm importing data about apples and want to assign a value to a custom field used by a theme to display the color. Let's say this field is named themeprefix_apple_color. How would I go about discovering that if I didn't know it beforehand?

  • There isn't a reliably way to do it. You could look for themeprefix_ in wp_options and wp_postmeta, but there's no guarantee they're named consistently. It would be up to the theme developer to document it. – Jacob Peattie Dec 19 '17 at 23:57
  • And that would only be useful if values for those fields had already been saved. If you want to know what possible fields there then you'd have to check all the theme's templates and functions for references to custom fields. This is an unreasonable thing to expect a user to do, so any theme that does add custom fields support should document it. – Jacob Peattie Dec 20 '17 at 2:08
  • @JacobPeattie I had just realized the fields are sort of discoverable once a post has been added with values given to those fields. It's a shame there isn't a globally-cataloged array of possible fields, as I'd never expect the trend of poor documentation to ebb. – theeastcoastwest Dec 20 '17 at 2:12
  • Any theme worth its salt these days would add distinct fields for custom meta to the edit screen. – Jacob Peattie Dec 20 '17 at 2:25
  • I'm not particularly familiar with Wordpress honestly, and was fighting to get some latitude/longitude data mapped to the proper fields during import. The theme didn't have metaboxes available on the edit screen, and was making some backend call to the Google GEOIP API and mapping to hidden fields (to me anyway). I'm sure I could have dug through the theme files, but man... – theeastcoastwest Dec 20 '17 at 2:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.