자주 발생하는 문제
자주 발생하는 문제예기치 않은 문자열 이스케이프 문자 '&'

예기치 않은 문자열 이스케이프 문자 '&'

다음과 같은 오류 메시지가 표시되는 경우:

Unexpected string escaped character '&'

...예를 들어 이와 같이:

{"message":"Unexpected string escaped character '&'","locations":[{"line":2596,"column":87}],"extensions":{"code":"gqlparser@4","specifiedBy":"https://spec.graphql.org/draft/#sec-Language"}}

해결 방법은: 플러그인을 비활성화한 후 다시 활성화하는 것입니다.

그 후, DB 캐시 플러그인을 사용하고 있다면 DB 캐시도 플러시해야 합니다.

문제 설명

이 문제의 원인은 GraphQL 쿼리 "translate-customposts"가 데이터베이스에 잘못 저장되었기 때문입니다.

이 문제는 플러그인을 처음 설치할 때만 발생하며, 라이선스가 미리 제공된 경우에만 발생하므로 이 오류는 매우 드뭅니다.

어떤 이유로(저희도 알 수 없는 이유로) WordPress가 쿼리를 저장할 때 내용을 손상시키는 경우가 있습니다.

원본 쿼리는 다음과 같이 되어 있음에도 불구하고:

    @underJSONObjectProperty(
      by: { key: "coreMediaTextAlt" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachJSONObjectProperty
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:media-text .*?-->\\n?<div .*><figure .*><img .*?alt=\\\")%s(\\\")#",
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: "coreMediaTextAltReplacementsFrom",
        )
      @underJSONObjectProperty(
        by: { key: "to" }
      )
        @export(
          as: "coreMediaTextAltReplacementsTo",
        )

...WordPress는 DB에 다음과 같이 저장합니다:

    @underJSONObjectProperty(
      by: { key: "coreMediaTextAlt" }
      affectDirectivesUnderPos: [1, 6]
    )
      @underJSONObjectProperty(
        by: { key: "from" }
        affectDirectivesUnderPos: [1, 4],
      )
        @underEachJSONObjectProperty
          @underEachArrayItem(
            passValueOnwardsAs: "value"
          )
            @applyField(
              name: "_sprintf",
              arguments: {
                string: "#(<!-- wp:media-text .*?-->\\n?<div><figure>&lt;img .*?alt=\\\&quot;)%s(\\\&quot;)#&quot;,
                values: [$value]
              },
              setResultInResponse: true
            )
        @export(
          as: &quot;coreMediaTextAltReplacementsFrom&quot;,
        )
      @underJSONObjectProperty(
        by: { key: &quot;to&quot; }
      )
        @export(
          as: &quot;coreMediaTextAltReplacementsTo&quot;,
        )

플러그인을 비활성화한 후 다시 활성화하면, 쿼리가 데이터베이스에 다시 저장되어 문제가 해결됩니다.