Truy vấn dữ liệu Plugin
Truy vấn dữ liệu PluginElementor

Elementor

Đọc thêm trong hướng dẫn Làm việc với Elementor.

Các ví dụ về queries để tương tác với dữ liệu từ plugin Elementor.

Lấy dữ liệu Elementor

Query này lấy dữ liệu Elementor từ một bài viết (được lưu trữ dưới dạng meta với mục _elementor_data), giữ nguyên cấu trúc dữ liệu như đã lưu trong cơ sở dữ liệu:

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

Query này lấy dữ liệu Elementor từ một bài viết, được làm phẳng thành một cấp duy nhất:

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

Cập nhật dữ liệu Elementor

Mutation này hợp nhất các phần tử cụ thể trong dữ liệu 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
      }
    }
  }
}