• Resolved tinydeskapp

    (@tinydeskapp)


    XMLRPC method wp.getPostTypes (or any other method) does not seem to return the names of the custom fields associated with a post type.

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    Exactly what version are you using?

    Thread Starter tinydeskapp

    (@tinydeskapp)

    Sorry, i am testing 3.4 beta 2

    Custom fields are arbitrary, so this isn’t something that we’d normally do for version 1 of a feature.

    A separate API would probably make sense for this, to query for all custom fields for a particular post type, which would normally show up in the dropdown in the Custom Fields box.

    Thread Starter tinydeskapp

    (@tinydeskapp)

    Hi Andrew,

    There are of course many use cases and hence its not my place to say how it should be and maybe a separate XMLRPC method is the best solution.

    The main issue from our humble perspective is that custom posts have limited value without knowing what the custom fields are. wp.getpostTypes now gives us knowledge of the post types but we can’t really use it because we have no way of constructing an input screen that incorporates all the required information to create a post of any given type– at least without apriori knowledge of the post type on the XMLRPC client side.

    All that being said, the new set of extended XMLRPC methods is otherwise fantastic:) The one further addition of a method to provide details of the relationship b/w custom post types and custom fields will, in my opinion, transform the WordPress platform.

    Thanks for the feedback tinydeskapp. We would really love to have included custom field metadata for custom post types, but unfortunately that is not possible with the current WordPress core design.

    Plugins and themes can register new post types without telling WordPress about what custom fields it intends to use; in fact, there is currently no API that tracks this at all. The closest proxy would be to look at admin metabox registrations, but even that is not foolproof.

    You could also try using wp.getPosts to retrieve a sample of posts of the custom post type and then look at the custom_fields value to see which fields are commonly used. Of course, this is not foolproof either, and doesn’t give you much information on datatypes or other metadata.

    The methods for 3.4 are primarily intended for when you have apriori knowledge of specific custom post types in your WordPress site(s).

    It’d be great if you (and/or your team) could give some feedback on what specific metadata you’d like to see available. Then for 3.5 we can have a discussion about enhancing core CPT APIs to allow plugins/themes to register such metadata.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘XMLRPC wp.getPostTypes – No custom field info’ is closed to new replies.