Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 -
- 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 -

Supporter timezone: Europe/Vienna (GMT+02:00)

This topic contains 1 reply, has 2 voices.

Last updated by Bigul 1 year, 5 months ago.

Assisted by: Bigul.

Author Posts
January 2, 2024 at 9:52 am #15142591

uabP

Hello, I am using wpgraphql plugin with advanced custom fields (ACF). It works correctly only in default language.

Is there a possibility to get information by specifying language code?

From documentation, it seems it works only with posts, since I am not able to use "where" argument - (where: {language: "en"})

ACF field is registered in functions.php
function register_acf_options_pages() {

// check function exists
if ( ! function_exists( 'acf_add_options_page' ) ) {
return;
}

// register options page
$my_options_page = acf_add_options_page(
array(
'page_title' => __( 'Team Option Page' ),
'menu_title' => __( 'Team Option Page' ),
'menu_slug' => 'team-options-page',
'capability' => 'edit_posts',
'show_in_graphql' => true,
'type' => "Post",
)
);
};

add_action( 'acf/init', 'register_acf_options_pages' );

Example query:

query members {
teamOptionsPage {
teamMembers {
member {
memberName
memberDescription
}
}
}
}

January 2, 2024 at 2:21 pm #15143755

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

We hope you are using WPML GraphQL with Gatsby and ACF. Just to make sure, have you tried the steps described in this article - https://wpml.org/documentation/related-projects/wpml-graphql/#using-wpml-graphql-with-gatsby-and-acf

Normally we can retrieve the values of ACF Options Page fields like the following. Refer to this article for more details - hidden link

$variable = get_field('field_name', 'option');

--
Thanks!

Bigul

The topic ‘[Closed] Is it possible to query Options page (ACF plugin) data by specifying language?’ is closed to new replies.