[Resolved] Error using Post Object on V 4.0.3
This is the first time I use this plugin and I admit this is really great, but unfortunately, I got an error when I am trying to echo the value of a post object. What I am want to do is first try to echo the value set in my Post Object, but I got this error message Post Object Custom Field:
Catchable fatal error: Object of class WP_Post could not be converted to string in C:\xampp\htdocs\wordpress\wp-content\plugins\advanced-custom-fields\core\api.php on line 389. I followed the sample code in the website and since I only have one value for every post object I modified the code and made it like this
$post_objects = get_field(‘field_51709d17971fb’);
if( $post_objects ): ?>
<?php foreach( $post_objects as $post_object): ?>
<span>Post Object Custom Field: <?php the_field(‘order_equipment_name’, $post_object->ID); ?></span>
<?php endforeach; ?>
Now my original plan is to update the quantity value in my product post type by subtracting the quantity in the order post type, to achieve this, I have to provide the specific postid of the said product in the post object.
I downloaded the last 3.5.8 version and will try if this will work out for me. I hope that it would cause I badly need this one. Thanks
I tried the version 3.5.8 but still I got the same error and also the custom fields that I created are still missing when I go to the custom fields, I can clearly see that there are 4 published custom fields but they aren’t showing. I don’t have other plugins installed aside from this and custom post type UI, I used to manually code the custom post type but I tried to use the plugin thinking that it might be the reason that my custom fields disappeared. But the same issue occurs. Thanks
- The topic ‘[Resolved] Error using Post Object on V 4.0.3’ is closed to new replies.