Post Object selector is showing selected option as [object Object]
-
I’m using Version 0.8.8.10 and for some reason the custom field for post object for a custom post type is showing [object Object]. I’ve tried switching from post object to post id and it still displays just [object Object]. It seems to select the correct one when making the selection but always displays [object Object] in the selected field.
- This topic was modified 2 years ago by shuangmiles.
The page I need help with: [log in to see the link]
-
Hello,
Thanks for the feedback!
I just tested it, and it works fine on my end. Here is the video of my test.
Note that ACF has some special escaping method which was introduced in order to fix the Select2 library with Woocommerce (which is used by the Post Object field too). Some custom code or third party plugins may break it pretty easily.
In order to understand where the problem come from, I would recommend to setup a clean WP install with ACF Pro + ACF Extended only, and test the feature on it. If you prefer to keep your installation, then try to disable all your plugins one-by-one (at the exception of ACF Pro & ACF Extended) until you find which one cause the issue.
If the problem persists, I would suggest switch to the native WP Twenty Twenty Two theme, to make sure you don’t have any custom code in your theme that would break the feature.
Hope it helps!
Have a nice day!
Regards.
If it helps I’m selecting posts from a custom post type. When we were using version 0.8.8.7 it was working as expected, so something must have changed.
Hello,
As explained above, ACF implemented a complex escape mechanics for the Select2 library which can be easily broke by some custom code/third party code if the code doesn’t handle it correctly.
As shown in my test video, the field works on a blank setup install, so your problem most likely come from a third party code/plugin.
Please follow my recommendations from my previous answer to know which one is causing this issue.
Regards.
I disabled Advanced Custom Fields: Extended PRO and it started to work as expected so it’s this plugin. I had disabled every other plugin and it still had the issue. So something is wrong with Advanced Custom Fields: Extended PRO.
Hello,
Looking at your other support threads, it looks like you’re using Woocommerce, which isn’t really surprising because ACF implemented the Select2 new escape method to fix this specific
[object Object]
issue you’re talking about with Woocommerce. See related ACF Github issue.A fix was then rolled out in ACF 5.10.1 update:
5.10.1
Release Date – 26 August 2021Fix – Fixed conflict with WooCommerce loading SelectWoo which is not directly compatible with Select2.
To get at the bottom of the problem, I made a new test with Woocommerce activated. Here is the list of the activated plugins and their versions.
- ACF Pro 6.0.3
- ACF Extended Pro 0.8.8.10
- Woocommerce 7.0.1
As you explained in your previous answer, you tried to disable other plugins at the exception of ACF + ACF Extended. Can you please do it again, and share the ACF/ACF Extended/Woocommerce version you’re using?
Note that the Post Object “Inline Add/Edit Post” settings is an ACF Extended Pro feature. As you suggested earlier you’re an ACF Extended Pro user, so if you use that feature in the Post Object, can you please submit a ticket from your ACF Extended Account Dashboard?
Thanks in advance.
Regards.
I didn’t post on that thread. I’m also not using woocommerce on this site.
I disabled every other plugin except for ACF Extended pro, still showing the [object Object].
Once I disabled ACF Extended Pro the field displays correctly.
Advanced Custom Fields: Extended PRO Version 0.8.8.10
I’m not sure which version of acf pro is being used I don’t see it in the plugin list.
Woocommerce is not being used on this site.
Hello,
Looks like you have a custom installation. If you can’t see ACF in the plugin list, then it’s probably included in your theme or a plugin.
Do you see a “Must-Use” link filter at the top of the plugins list? It might be in there.
In order to see which ACF Pro version you’re using you can go in the “Custom Fields > Updates” admin menu. URL:
/wp-admin/edit.php?post_type=acf-field-group&page=acf-settings-updates
. Here you should see your ACF Pro version on the left.If you can’t see that menu, you can try to add the following code in your theme’s
functions.php
file:add_action('admin_init', 'my_admin_init'); function my_admin_init(){ echo '<pre style="position:absolute;z-index:10000000;background:#ccc; display:block; top:0;">ACF Version: '; print_r(ACF_VERSION); echo '</pre>'; }
The ACF version will be display in your admin dashboard on the top left corner.
Can you please export the Field Group that display the Post Object? So I can import it on my test setup and have the exact same configuration. You can export Field Groups from the “Custom Fields > Tools” menu. You can post the Json export here.
Thanks.
Regards.
Thank you the acf pro version is ACF Version: 5.9.5
{
“key”: “group_620c386bf40b8”,
“title”: “Disclosure Selector”,
“fields”: [
{
“key”: “field_620c38a5cc737”,
“label”: “Disclaimer”,
“name”: “disclaimer”,
“type”: “post_object”,
“instructions”: “Leave blank to use default”,
“required”: 0,
“conditional_logic”: 0,
“wrapper”: {
“width”: “”,
“class”: “”,
“id”: “”
},
“post_type”: [
“disclaimers”
],
“taxonomy”: “”,
“allow_null”: 0,
“multiple”: 0,
“max”: “”,
“return_format”: “object”,
“save_custom”: 0,
“save_post_status”: “publish”,
“acfe_add_post”: 0,
“acfe_edit_post”: 0,
“acfe_bidirectional”: {
“acfe_bidirectional_enabled”: “1”,
“acfe_bidirectional_related”: “”
},
“acfe_field_group_condition”: 0,
“ui”: 1,
“save_post_type”: “”,
“min”: “”
}
],
“location”: [
[
{
“param”: “post_type”,
“operator”: “==”,
“value”: “post”
}
],
[
{
“param”: “post_type”,
“operator”: “==”,
“value”: “page”
}
],
[
{
“param”: “post_type”,
“operator”: “==”,
“value”: “funds”
}
],
[
{
“param”: “post_type”,
“operator”: “==”,
“value”: “landing”
}
]
],
“menu_order”: 0,
“position”: “side”,
“style”: “default”,
“label_placement”: “top”,
“instruction_placement”: “label”,
“hide_on_screen”: “”,
“active”: true,
“description”: “”,
“acfe_autosync”: [
“json”
],
“acfe_form”: 0,
“acfe_display_title”: “Disclosure”,
“acfe_meta”: “”,
“acfe_note”: “”
}Great!
Can you please share your Field Group json?
Can you please export the Field Group that display the Post Object? So I can import it on my test setup and have the exact same configuration. You can export Field Groups from the “Custom Fields > Tools” menu. You can post the Json export here.
Thanks.
Hello,
Thanks for the Field Group export. Looking at your Field Group, the issue might be related to the ACF Extended Pro package. Unfortunately I cannot provide support for Pro features on this forum.
Can you please open a ticket from your Account Dashboard? I’ll answer you there.
Thanks.
Regards.
- The topic ‘Post Object selector is showing selected option as [object Object]’ is closed to new replies.