0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WordPressのsearch regexプラグインで、REST APIが404エラー

Posted at

WordPressのsearch regexプラグインは、複数記事の文字列を一括置換する際に便利でよく利用しています。しかし、最近のバージョンアップで以下のエラーが出るようになってしまいました。

URL とリクエストメソッドに一致するルートがありません (rest_no_route)

Your REST API is returning a 404 page. This is almost certainly a plugin or server configuration issue and not a problem with Redirection.

  • Can you access your REST API without it redirecting? You will need to fix any errors.
  • Check your Site Health and fix any issues.
  • Your server configuration is blocking access to the REST API. You will need to fix this.
  • A security plugin or firewall is blocking access. You will need to whitelist the REST API.

WordPressのREST APIを今まで特に使おうとしたことがなかったので、とりあえず動作確認をするため以下のURLを叩いてみたところ、404が帰ってきました。

で、なんで動作しないのかググってみると、パーマリンクを「基本」(デフォルト)にしている場合は、REST APIの叩き方が変わります。以下のURLを叩いたらレスポンスが返ってきました。

Can I use REST-API on plain permalink format?
https://wordpress.stackexchange.com/questions/273144/can-i-use-rest-api-on-plain-permalink-format

パーマリンクがデフォルトの場合のREST APIエンドポイントに、search regexプラグインが対応していないのが原因ぽいです。パーマリンク設定を「カスタム構造」にして以下の設定値にすればなんとかなるかと試してみましたが、カテゴリページのURLがおかしくなってしまったので断念。結局解決しませんでした。

?p=%post_id%

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?