Support

Account

Home Forums Bug Reports Post Object / Relationship Field doesn’t work properly with multiple post types

Unread

Post Object / Relationship Field doesn’t work properly with multiple post types

  • I am not sure if this is a bug or wrong understanding of how fields should work.

    In my case, I want to provide a way to include articles (post_type=’post’) and case studies (custom post_type=’case_study’) to specific pages of the website. So we can output these posts as “Related Items” at the bottom of the page.

    I covered the field setup and all the logic by using “Post Object” field that should support 2 post_types = post & case_study.

    The field appears in the wp editor but it suggests only articles of “post” type. “case_study” options are not there.

    I tried to replace the “post” type with another custom post type and everything works properly. However when I bring “post” type back to the settings, it doesn’t work.

    The issue is related to “Post Object” and “Relationship” fields. They simply don’t show posts of “case_study” when “post” is mentioned.

    Here is how the field looks like:

    `
    array(
    ‘key’ => ‘field_646a1e151cb01’,
    ‘label’ => ‘case_studiess’,
    ‘name’ => ‘case_studiess’,
    ‘aria-label’ => ”,
    ‘type’ => ‘post_object’,
    ‘instructions’ => ”,
    ‘required’ => 0,
    ‘conditional_logic’ => 0,
    ‘wrapper’ => array(
    ‘width’ => ”,
    ‘class’ => ”,
    ‘id’ => ”,
    ),
    ‘post_type’ => array(
    0 => ‘post’, // The problematic part is here. If I replace “post” with any other custom post type, everything works properly.
    1 => ‘case_study’,
    ),
    ‘post_status’ => ”,
    ‘taxonomy’ => ”,
    ‘return_format’ => ‘id’,
    ‘multiple’ => 1,
    ‘translations’ => ‘copy_once’,
    ‘allow_null’ => 0,
    ‘ui’ => 1,
    ),
    `

    Any ideas what’s going wrong here?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.