Home Forums General Issues Unable to display post objects list


Unable to display post objects list

  • I have a test site I’ve been experimenting with.

    I have 2 custom post types – One is “Doctors”, the other is “Facilities”.

    I’d like to be able to link doctors with their facilities they service. That way, when someone visits the doctor’s post page, it displays an array of the facilities that they service, (hopefully with links to these facilites.)

    I am using the Divi Theme Builder to display the doctor’s name, and their specialties. I have no issues with these two values.

    But when I add a post object and link the doctor to the facility and try to display this, nothing displays. Even worse, when I enable multiple values within the post object and select multiple values, I get the following error:

    Fatal error: Uncaught Error: Object of class WP_Post could not be converted to string in /home/test/public_html/dtm/wp-content/themes/Divi/includes/builder/plugin-compat/advanced-custom-fields.php:303 Stack trace: #0 /home/test/public_html/dtm/wp-content/themes/Divi/includes/builder/plugin-compat/advanced-custom-fields.php(303): implode(‘, ‘, Array) #1 /home/test/public_html/dtm/wp-content/themes/Divi/includes/builder/plugin-compat/advanced-custom-fields.php(98): ET_Builder_Plugin_Compat_Advanced_Custom_Fields->format_field_value(Array, Array) #2 /home/test/public_html/dtm/wp-includes/class-wp-hook.php(308): ET_Builder_Plugin_Compat_Advanced_Custom_Fields->maybe_filter_dynamic_content_meta_value(Array, ‘post_object_fac…’, 32) #3 /home/test/public_html/dtm/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #4 /home/test/public_html/dtm/wp-content/themes/Divi/includes/builder/feature/dynamic-content.php(1674): apply_filters(‘et_builder_dyna…’, Array, ‘post_object_fac… in /home/alighttest/public_html/dtm/wp-content/themes/Divi/includes/builder/plugin-compat/advanced-custom-fields.php on line 303

    Any insight?

  • Also, if I enable “Post ID” instead of “POst Object” in the field, it displays the post ID’s in an array.

  • Hi @yourfriends

    To troubleshoot this issue, I would recommend checking the following:

    Make sure that you have set up the post object field correctly in ACF and that you have selected the correct post type (Facilities) to link with the doctor’s post.

    Check that the doctor’s post is linked correctly to the facility post. You can do this by going to the doctor’s post page and checking that the facility post is selected in the post object field.

    Verify that you have correctly configured the ACF code to display the facilities on the doctor’s post page. You may need to use a loop to iterate through the linked facilities and display them as links.

    If none of the above steps solve the issue, you may want to reach out to the ACF support team or the Divi theme support team for further assistance.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.