-
Notifications
You must be signed in to change notification settings - Fork 63
Description
I've added a post_object field to select a page on an options page:
$fields = new FieldsBuilder( __( 'Settings' ) );
$fields
->addTab( __( 'Pages' ) )
->addGroup( 'custom_pages', [ 'label' => __( 'Custom pages' ) ] )
->addPostObject( 'my_custom_page',
[
'label' => 'My custom page',
'post_type' => 'page',
'return_format' => 'post_id'
]
)
->endGroup();This works fine under the default language, but after installing WPML and choosing the second language in the CMS the selectlist comes up empty when searching for posts (pages).
Creating the same field through the 'default' ACF UI this works though.
After some experimenting I found that there's a difference: Fields added through ACF UI are added to the database and I think WPML does something with this info.
The default ACF UI field sends its request when searching for posts like this:
action: acf/fields/post_object/query
s: priv
paged: 1
field_key: field_63a0514701ad3
nonce: b73c2b26a5
post_id: options
lang: en
The field added through the Stoutlogic ACF Builder sends it POST form-data like this:
action: acf/fields/post_object/query
s: priv
paged: 1
field_key: field_settings_custom_pages_my_custom_page
nonce: b73c2b26a5
post_id: options_nl
lang: nl
Now in the posts table in the database, there exists a post for field_63a0514701ad3 having the post_type acf-field. But these do not exists for our fields added through the Stoutlogic ACF builder.
After adding field_settings_custom_pages_my_custom_page in the database as post_type acf_field results appear in the selectlist.
Is there any way to navigate this issue? In the original language it isn't in the database either of course but it still returns posts when searching in the select list.
Edit: Well, the language of the original (EN) and 2nd language (NL) are also sent to the query in the post variables post_id and lang.
I've tried this as well but to no avail: #99