Queryライブラリ
Queryライブラリ管理者にメールを送信する

管理者にメールを送信する

このクエリは、WordPress の wp_options テーブルから管理者ユーザーのメールアドレスを取得し、その値を to フィールドに注入します。

query ExportData {
  adminEmail: optionValue(name: "admin_email")
    @export(as: "adminEmail")
}
 
mutation SendEmailToAdmin @depends(on: "ExportData") {
  _sendEmail(
    input: {
      to: $adminEmail
      subject: "Admin notification"
      messageAs: {
        html: "There is a new post on the site, go check!"
      }
    }
  ) {
    status
  }
}