プラグインデータのクエリ
プラグインデータのクエリElementor

Elementor

ガイド Working with Elementor で詳細をご覧ください。

Elementor プラグインのデータを操作するクエリの例を紹介します。

Elementorデータの取得

このクエリは、投稿から Elementor データを取得します(DBに _elementor_data というメタエントリとして保存されており、DBに格納されているデータの構造をそのまま保持します):

{
  post(by: { id: 1 }) {
    elementorData
  }
}

このクエリは、投稿から Elementor データを取得し、単一レベルにフラット化します:

{
  post(by: { id: 1 }) {
    elementorFlattenedDataItems
  }
}

Elementorデータの更新

このmutationは、Elementor データ内の特定の要素をマージします:

mutation {
  elementorMergeCustomPostElementDataItem(input: {
    customPostID: 1
    elements: [
      {
        id: "164e55c4",
        settings: {
          title: "Updated title"
        }
      }
    ]
  }) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
    customPost {
      __typename
      ...on CustomPost {
        id
        elementorData
      }
    }
  }
}