Consultar datos de plugins
Consultar datos de pluginsWP Meta SEO

WP Meta SEO

Ejemplos de consultas para interactuar con datos del plugin WP Meta SEO.

Obtener metadatos SEO

Podemos usar Valores meta para consultar los metadatos SEO:

query GetPost($postId: ID!) {
  post(by: { id: $postId }) {
    id
    title
 
    metaTitle: metaValue(key: "_metaseo_metatitle")
    metaDesc: metaValue(key: "_metaseo_metadesc")
    focusKeyword: metaValue(key: "_metaseo_metaspecific_keywords")
    socialFBTitle: metaValue(key: "_metaseo_metaopengraph-title")
    socialFBDesc: metaValue(key: "_metaseo_metaopengraph-desc")
    socialFBImage: metaValue(key: "_metaseo_metaopengraph-image")
    socialTwitterTitle: metaValue(key: "_metaseo_metatwitter-title")
    socialTwitterDesc: metaValue(key: "_metaseo_metatwitter-desc")
    socialTwitterImage: metaValue(key: "_metaseo_metatwitter-image")
  }
}

Actualizar metadatos SEO

Podemos usar Valores meta para actualizar los metadatos SEO:

mutation UpdatePost($postId: ID!) {
  updateCustomPostMetas(inputs: [
    { id: $postId, key: "_metaseo_metatitle", value: "New title" },
    { id: $postId, key: "_metaseo_metadesc", value: "New description" },
    { id: $postId, key: "_metaseo_metaspecific_keywords", value: "New focus keyword" },
    { id: $postId, key: "_metaseo_metaopengraph-title", value: "Social title" },
    { id: $postId, key: "_metaseo_metaopengraph-desc", value: "Social description" },
    { id: $postId, key: "_metaseo_metaopengraph-image", value: "https://example.com/social-image.jpg" },
    { id: $postId, key: "_metaseo_metatwitter-title", value: "Social title" },
    { id: $postId, key: "_metaseo_metatwitter-desc", value: "Social description" },
    { id: $postId, key: "_metaseo_metatwitter-image", value: "https://example.com/social-image.jpg" },
  ]) {
    status
    errors {
      __typename
      ...on ErrorPayload {
        message
      }
    }
    customPost {
      __typename
      id
      metaTitle: metaValue(key: "_metaseo_metatitle")
      metaDesc: metaValue(key: "_metaseo_metadesc")
      focusKeyword: metaValue(key: "_metaseo_metaspecific_keywords")
      socialFBTitle: metaValue(key: "_metaseo_metaopengraph-title")
      socialFBDesc: metaValue(key: "_metaseo_metaopengraph-desc")
      socialFBImage: metaValue(key: "_metaseo_metaopengraph-image")
      socialTwitterTitle: metaValue(key: "_metaseo_metatwitter-title")
      socialTwitterDesc: metaValue(key: "_metaseo_metatwitter-desc")
      socialTwitterImage: metaValue(key: "_metaseo_metatwitter-image")
    }
  }
}