• How to I get the value of a custom field in the admin?

    I have created a custom post type that will hold images
    I have created a custom image field for the custom post type
    I would like to show this image in the post list for the custom post type (i.e. on edit.php)

    When I try to call types_render_field on an admin display page to show the image I get:
    Fatal error: Call to undefined function types_render_field() in…

    Is there any way to get the values for the custom fields in the admin area?

    I’ve tried get_posts to get attachments and setting “meta_key” to the key that is stored in the database “wpcf-custom-image” and I’ve tried it without the “wpcf-” prefix, neither return anything.

    What am I missing, or is it impossible to do this?


Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Hube2,

    Please include include: embedded/frontend.php. Because function is in frontend.php. That is not included to admin pages, it is only for front end page.

    [ Signature moderated. ]

    Well, that sounds like a pain. Fields should be available in the admin just like the front end. I’m creating a custom post type with custom fields. Why wouldn’t I want to customize the rest of the admin to show relevant field columns.

    Thanks anyway

    Hi Hube2,

    Sorry this feature is not included now. But you can view the fields in Post edit screens.

    [ Signature moderated. ]

    Hey – is this still the case? It would be nice if there was at least a function to run the include so I didn’t have to get into looking at the directories to do the include. I understand only wanting it to be loaded at certain times, but a function to get this functionality outside the display side would be awesome.

    Seems to still be the case. I’m using a different custom fields plugin now.

    You can use:
    types_get_field_meta_value( $field, $post_id )

    $field – Field name (without ‘wpcf-‘ prefix)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘get custom field in admin’ is closed to new replies.