Bug: Custom fields with value attribute not working

Custom fields with value attribute not working outside the post of it's respective custom post type. For eg, the following shortcode doesn't work inside the default post:
[ct id="_ct_editor_5945eb5d587be" property="value"]

  • Nithin
    • Support Wizard

    Hello kalico,

    Hope you are doing good today :slight_smile:

    I was able to replicate the same, I'm marking this as a bug, and will ask one of the developers to give a closer look at this. Will keep you posted once I get a feedback regarding this from the developer. Have a nice day ahead. :slight_smile:

    Best Regards,

  • kalico
    • The Bug Hunter

    Thank you for your help today, Nithin

    A bit more detail for the developers from my experience: I used the above shortcode in a page, as Nithin stated, and it doesn't display anything.

    I also used the


    shortcode in a page, and it also displays nothing.

    But static properties of the post type will display, such as description or title:

    [ct id="_ct_editor_5945eb5d587be" property="description | title"]

  • Lindeni Mahlalela
    • Recruit

    Hello kalico,

    I hope you are doing well today. I am really sorry about the inconveniences you are having with CustomPress and I hope we resolve this soon.

    In my attempt to find out what the issue is with this, I have setup the plugin on my website and I have created a custom post type with custom fields for this custom post type. I then played with the settings and short codes in an attempt to replicate the issue.

    Basically, the Custom Fields are attached to a specific post, so in order to display the values of a custom post type then you will need to add the shortcode on the post editor of that custom post type item or add it in the template file for that post type. For example, if you have a "members" custom post type, and your field as:

    [ct id="_ct_editor_5945eb5d587be" property="value"]

    then you specify the value when editing the member in the post editor. This value will be available when viewing the member. Let us go through an example:

    1. Create the custom post and custom fields or edit an existing one. I have set the following parameters:
    name: member
    public: true
    hierachical: false
    supports: title, editor, except, thumbnail
    Custom Fields: Biography, Age, Subscription

    2. After saving the post type. then go to "Custom Fields" and create the custom fields required. Here you need to choose the post type to which this custom field must apply to. I have chosen the 'member' post type I created earlier and choose which post type should not have access to this field.

    If you want this field to be available for pages and other post types you should select them on the "Post type" meta box when creating or editing the custom fields as shown in the screenshot above.

    3. Now you can go to the dashboard and add a new member by going to "Members > Add New".
    a. Add the [custom_fields_block] block or the individual custom fields in the post editor. You may not have to do this if you have a page template for the custom post type.

    b. Specify the values for the custom fields in the custom fields box.

    4. Publish and view the new member by clicking. This is how it looks:

    This is by default how it should work by default. Now, going back to your questions:

    Custom fields with value attribute not working outside the post of it's respective custom post type.

    A bit more detail for the developers from my experience: I used the above shortcode in a page, as Nithin stated, and it doesn't display anything.

    Custom fields are like another custom post type, they have no values when displayed in an external page or post. Their values are specified when adding them to a specific post of its custom post type or any other post specified in the "Post Type" setting in the Custom Field editor. If you'd rather display it on a post then that particular post must have its own values for the custom fields.

    So for example, create the custom field, choose to show it in pages or post or custom post type as seen in the screenshot in step 2 above. Then go create a new page/post like in step 3 above. Then you should be able to view the page and see the details like in step 4.

    When viewing the custom post, you may encounter a 404 depending on the them you are using. You will need to double check the rewrite or slug settings in the post type editor and you may additionally have to specify the settings to create a template file for the custom post type. You can do so in the settings page, "CustomPress > Settings":

    [image pos="5"]

    After that, you should have a new file 'single-<custom-post-type-slug>.php' in the case of member post type, I have 'single-member.php'

    [image pos="6"]

    which can be used to build the page to display the custom fields without adding them in the post editor. You should then edit this post type and add the custom fields like so:

    <?php echo do_shortcode('[ct id="_ct_text_596346a12e9e7" property="title | description | value | link | image"]'); ?>

    That should be it.

    If you really need to be able to add or embed the details of the custom field, then the shortcodes need to be modified so that they accept the post id for the custom post type and grab the details of that post and display it anywhere. But this is currently not how CustomPress works. It may be a feature request or just your custom workaround. I say this because it is not possible to display the values of a custom field without the id of the post of whose custom fields we need to display.

    If you need help making it work with the custom post types you created so you can view them without the need to embed in other pages, then simply grant support access to your website and I will have a look.

    I hope this helps, please let us know if you need any further help.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.