Query Plugin DataElementor
Elementor
Examples of queries to interact with data from the Elementor plugin.
Fetching Elementor data
This query fetches the Elementor data from a post (stored as meta under entry _elementor_data
), keeping the structure of the data as stored in the DB:
{
post(by: { id: 1 }) {
elementorData
}
}
This query fetches the Elementor data from a post, flattened to a single level:
{
post(by: { id: 1 }) {
elementorFlattenedDataItems
}
}
Updating Elementor data
This mutation merges specific elements in the Elementor data:
mutation {
elementorMergeCustomPostElementDataItem(input: {
customPostID: 1
elements: [
{
id: "164e55c4",
settings: {
title: "Updated title"
}
}
]
}) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
customPost {
__typename
...on CustomPost {
id
elementorData
}
}
}
}