Skip Navigation


Reported for: WPML GraphQL 1.0.0

Topic Tags: Bug, Compatibility

Overview of the issue

When using GraphQL and utilizing a query similar to the following to retrieve Custom Post Types by slug, you will discover that it functions only for the posts in the default language:

query getArticlesByslug {
  article(id: "your-slug-goes-here", idType: SLUG) {


Please, make sure of having a full backup of your site before proceeding.

  • Open your theme’s functions.php file.
  • Add this code:
    add_filter('request', function($vars){
    	if ( is_graphql_http_request() && !empty($vars['name']) ) {
    		$vars['suppress_filters'] = true;
    	return $vars;

5 Responses to “WPML GraphQL - Fails to Fetch Single Custom Post Type by Slug Based”

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>