查询插件数据Elementor
Elementor
在指南 Working with Elementor 中了解更多信息。
以下是与 Elementor 插件数据交互的 query 示例。
获取 Elementor 数据
此 query 从文章中获取 Elementor 数据(以 _elementor_data 为键存储在元数据中),并保持数据在数据库中存储的结构:
{
post(by: { id: 1 }) {
elementorData
}
}此 query 从文章中获取 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
}
}
}
}Prev
Next