ブログ復活の備忘録

酒すごろくのブログが突然エラーで開けなくなっており、一時修正して復活させました。

問題となっているプラグインがPixabay Imagesとgoogle WP Custom Fields Searchとo-express-for-google、DBを更新したり何やらして直しました。けっこう大変でしたがやっぱりプログラミング好きなんだなあと思えてまあ良かったです。

特にこのブログの中枢を担っているWP Custom Fields Searchはもうかれこれ5年以上前から更新が途絶えており、有志の手によって1年前の更新情報を目安に変更を加え、本当に付け焼き刃でなんとか治りましたとさ。よかったよかった。ただし点数評価表示は今後使えない可能性もあるので、なんとかやっていければなあとは思っています。PHPの更新があるたびにこのプログラム更新するのも面倒なので、なんか点数とか良いなあと思った方はぜひ記録しておくといいかも??と思ったりもしています。

偉大な有志
https://wordpress.org/plugins/wp-custom-fields-search/

以下は備忘録
ChatGPT先生とやり取りした備忘録

サイドバーを開く

ChatGPT 4

User

あなた

保存して提出

キャンセルChatGPT

ChatGPT

The error message you’re seeing indicates that the str_starts_with() function is being declared more than once within your WordPress installation. This typically happens because PHP 8 introduced str_starts_with() as a native function, and it seems like one of your plugins or themes, or even WordPress core in older versions, is trying to declare it again for compatibility with older PHP versions. The error specifically points out that the conflict is between a file in the WordPress core (/wp-includes/compat.php) and a plugin (/wp-content/plugins/photo-express-for-google/photo-express.php).

Here’s how you can address the issue:

  1. Update PHP, WordPress, Themes, and Plugins: Ensure that your PHP version is up-to-date and compatible with your WordPress version, and that all themes and plugins are updated to their latest versions. This is crucial because newer versions of themes, plugins, and WordPress itself are compatible with PHP 8 and would not attempt to redeclare this function.
  2. Disable the Offending Plugin Temporarily: To quickly get your site back up:
    • Access your site via FTP or your web host’s file manager.
    • Navigate to the /wp-content/plugins/ directory.
    • Rename the photo-express-for-google plugin folder (for example, to photo-express-for-google-disabled). This will deactivate the plugin.
    • Try accessing your site again. If it works, the issue is definitely with the plugin.
  3. Check for Custom Code: If you have added any custom code to your theme’s functions.php file or a site-specific plugin that declares str_starts_with(), consider removing or updating that code.
  4. Contact Plugin Support: If the issue is specifically with the “Photo Express for Google” plugin and updating didn’t help, consider reaching out to the plugin’s support forum or contact page for help. They might have a patch or workaround for this issue.
  5. Consider a Compatibility Plugin: If you are stuck with an older version of PHP or WordPress for any reason, consider using a plugin designed to shim missing PHP functions without causing redeclaration errors. However, this is generally a less desirable solution compared to updating your environment.
  6. Custom Fix: If you’re comfortable with PHP, you can conditionally declare the function in your plugin or theme, but this should be done with caution:phpCopy codeif (!function_exists('str_starts_with')) { function str_starts_with($haystack, $needle) { // Implement the function for PHP versions < 8.0 } } However, since the error is coming from a plugin and core WordPress file, modifying plugin code directly isn’t recommended because your changes will be overwritten with an update. Ideally, the plugin author should fix this issue.

Remember to always back up your site before making any changes, especially when updating PHP versions or making direct modifications to plugin or theme files.

User

ChatGPT

表示されているエラーメッセージは、str_starts_with() 関数がWordPressのインストール内で複数回宣言されていることを示しています。これは、PHP 8で str_starts_with() がネイティブ関数として導入されたため、プラグインやテーマ、あるいは古いバージョンのWordPressコアが古いPHPバージョンとの互換性のために再度宣言しようとしている場合に発生します。エラーは具体的に、WordPressコアのファイル(/wp-includes/compat.php)とプラグイン(/wp-content/plugins/photo-express-for-google/photo-express.php)の間で衝突が起きていることを指摘しています。

この問題を解決する方法は以下の通りです:

  1. PHP、WordPress、テーマ、プラグインを更新する:PHPバージョンが最新で、WordPressバージョンと互換性があること、また、すべてのテーマとプラグインが最新バージョンに更新されていることを確認します。これは重要です。なぜなら、テーマ、プラグイン、WordPress自体の新しいバージョンはPHP 8と互換性があり、この関数を再宣言しようとはしないからです。
  2. 問題のあるプラグインを一時的に無効化する:サイトをすぐに復旧させるために:
    • FTPまたはWebホストのファイルマネージャーを使用してサイトにアクセスします。
    • /wp-content/plugins/ ディレクトリに移動します。
    • photo-express-for-google プラグインフォルダの名前を変更します(例:photo-express-for-google-disabled)。これによりプラグインが無効化されます。
    • サイトに再度アクセスしてみてください。問題が解決していれば、プラグインに問題があることが確認できます。
  3. カスタムコードをチェックする:テーマの functions.php ファイルやサイト固有のプラグインに str_starts_with() を宣言するカスタムコードを追加している場合は、そのコードを削除または更新を検討してください。
  4. プラグインのサポートに連絡する:「Photo Express for Google」プラグインに具体的な問題があり、更新しても解決しない場合は、プラグインのサポートフォーラムやコンタクトページで助けを求めてください。彼らはこの問題に対するパッチや回避策を持っているかもしれません。
  5. 互換性プラグインを検討する:何らかの理由で古いバージョンのPHPやWordPressを使用している場合は、再宣言エラーを引き起こさないように欠けているPHP関数を補うプラグインの使用を検討してください。しかし、環境を更新することに比べると、これは一般的に望ましくない解決策です。
  6. カスタム修正:PHPに精通している場合は、プラグインやテーマで関数を条件付きで宣言することができますが、注意が必要です:phpCopy codeif (!function_exists('str_starts_with')) { function str_starts_with($haystack, $needle) { // PHPバージョン<8.0用に関数を実装 } } しかし、エラーがプラグインとWordPressコアファイルから来ているので、直接プラグインのコードを修正することはお勧めしません。アップデートで変更が上書きされるからです。理想的には、プラグインの作者がこの問題を修正するべきです。

特にPHPバージョンを更新する場合やプラグインやテーマファイルに直接変更を加える場合は、サイトのバックアップを取ることを忘れないでください。

User

あなた

Warning: mysqli_real_connect(): (HY000/1045): Access denied for user ‘jazzing’@’49.212.180.30’ (using password: YES) in /home/jazzing/www/sakesugoroku/wp-includes/wp-db.php on line 1633 Access denied for user ‘jazzing’@’49.212.180.30’ (using password: YES)ChatGPT

ChatGPT

このエラーメッセージは、WordPressがデータベースに接続しようとした際に、「jazzing」というユーザー名でパスワードを使用しても、IPアドレス「49.212.180.30」からのアクセスが拒否されたことを示しています。これは一般的に、データベースのユーザー名、パスワード、ホスト名、または接続情報が正しくないか、データベースサーバーの設定で特定のIPアドレスやユーザーからの接続が許可されていない場合に発生します。

この問題を解決するためのステップは以下の通りです:

  1. wp-config.phpを確認する
    • WordPressのルートディレクトリにあるwp-config.phpファイルを開きます。
    • データベース接続情報(DB_NAME, DB_USER, DB_PASSWORD, DB_HOST)が正しいことを確認します。これらの値がデータベースサーバーで設定したものと一致している必要があります。
  2. データベースユーザーの権限を確認する
    • 使用しているデータベース管理ツール(例:phpMyAdmin、MySQL Workbench)を使用して、jazzingユーザーがデータベースにアクセスし、操作するための適切な権限を持っていることを確認します。
  3. データベースサーバーの設定を確認する
    • データベースサーバーが外部のIPアドレスからの接続を許可しているか確認します。多くの場合、データベースサーバーはセキュリティ上の理由から特定のIPアドレスやローカルホストからの接続のみを許可しています。
  4. パスワードを再確認またはリセットする
    • 入力したパスワードが正しいか再確認します。タイプミスがないか、余計なスペースが入っていないかなど、細かい点もチェックしてください。
    • 必要であれば、データベースのユーザーパスワードをリセットしてみてください。
  5. ホスティングプロバイダーのサポートに連絡する
    • 上記のステップを試しても問題が解決しない場合は、ホスティングプロバイダーのサポートチームに連絡してサポートを求めてください。特に、データベースサーバーの設定や外部からの接続を許可する設定に関しては、プロバイダー側で対応が必要な場合があります。

これらのステップを踏んで問題が解決しない場合は、エラーメッセージの詳細や、行った試みについてさらに情報を提供してください。それにより、より具体的なアドバイスを提供することが可能になります。

User

あなた

Notice: Trying to access array offset on value of type bool in /home/jazzing/www/sakesugoroku/wp-content/plugins/pixabay-images/pixabay-images.php on line 34 Notice: Trying to access array offset on value of type bool in /home/jazzing/www/sakesugoroku/wp-content/plugins/pixabay-images/pixabay-images.php on line 34 Warning: Declaration of GreatRealEstateJoiner::sql_join($join) should be compatible with BaseJoiner::sql_join($join, $name, $index, $value, $comparison) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/greatrealestate.php on line 39 Warning: Declaration of SortingComparison::sql_order($order, $field, $value) should be compatible with Comparison::sql_order($order) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/sort-order.php on line 31 Warning: Declaration of SortingComparison::shouldJoin() should be compatible with Comparison::shouldJoin($value) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/sort-order.php on line 27 Warning: Declaration of DB_CustomSearch_Widget::getTitle($params) should be compatible with DB_Search_Widget::getTitle() in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 123 Warning: Declaration of AdminDropDown::getInput() should be compatible with DropDownField::getInput($name, $joiner, $fieldName = NULL) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 452 Warning: Declaration of AdminDropDown::getValue() should be compatible with Field::getValue($name) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 449 Warning: Declaration of AdminDropDown::getHTMLName() should be compatible with Field::getHTMLName($name) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 446 Deprecated: Non-static method DB_CustomSearch_Widget::init() should not be called statically in /home/jazzing/www/sakesugoroku/wp-includes/class-wp-hook.php on line 288 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-login.php on line 496 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-login.php on line 512 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 6035 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-includes/pluggable.php on line 1267 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-includes/pluggable.php on line 1270ChatGPT

ChatGPT

このエラーメッセージのリストには、いくつかの異なる問題が含まれています。これらの問題を一つずつ見ていきましょう:

Notice: Trying to access array offset on value of type bool

この通知は、pixabay-images.phpファイルの34行目で、配列のオフセットにアクセスしようとしているが、対象の値がブール型(trueまたはfalse)であるために発生しています。これは通常、期待される配列ではなく、何らかの理由でブール値が返されているために起こります。例えば、何かの関数が失敗してfalseを返した場合などです。この問題を解決するには、該当のコード行を確認し、その値が配列であることを確認するか、ブール値を返す可能性がある場合は適切なチェックを行う必要があります。

Warning: Declaration of…

これらの警告は、プラグインのクラスのメソッド宣言が、親クラスまたはインターフェースで宣言されているメソッドと互換性がないことを示しています。PHPでは、サブクラスのメソッドは、引数の数や型、返り値の型が親クラスで宣言されているものと一致する必要があります。これを修正するには、該当するプラグインのコードを編集し、メソッド宣言を親クラスのものと一致させる必要がありますが、これはプラグインの更新によって上書きされる可能性があるため、プラグインの開発者に問題を報告することをお勧めします。

Deprecated: Non-static method DB_CustomSearch_Widget::init() should not be called statically

この非推奨警告は、非静的メソッドが静的に呼び出されたことを示しています。これを修正するには、メソッドを静的に宣言するか、静的でない方法で呼び出す必要があります。この問題も、プラグインのコードを直接修正するか、プラグインの開発者に連絡する必要があります。

Notice: wp_enqueue_script was called incorrectly

この通知は、wp_enqueue_script関数が正しくないタイミングで呼び出されたことを示しています。WordPressでは、スクリプトとスタイルはwp_enqueue_scriptsadmin_enqueue_scripts、またはlogin_enqueue_scriptsフックを使用して登録またはエンキューする必要があります。この問題を解決するには、プラグインまたはテーマのコードを確認し、該当する関数が適切なアクションフック内で呼び出されていることを確認してください。

Warning: Cannot modify header information – headers already sent by

この警告は、HTTPヘッダーを送信しようとした時に、既に出力が開始されている(たとえば、HTML、空白、エラーメッセージなどが既にブラウザに送信されている)場合に発生します。これは通常、PHPファイルの先頭にある不要な空白や、エラーメッセージが出力されることによって起こります。この問題を解決するには、エラーメッセージが出力される原因を特定して修正する必要があります。また、PHPファイルの開始タグの前や終了タグの後に余計な空白や改行がないことを確認してください。

これらの問題は、特定のプラグインやWordPressのコアファイルに関連しているため、修正にはPHPの知識が必要になります。プラグインの開発者に連絡するか、WordPressコミュニティのサポートフォーラムで助けを求めることをお勧めします。また、これらの問題が発生した直後に何か変更を加えた場合は、その変更を元に戻すことで問題が解決する可能性もあります。

User

あなた

Notice: Trying to access array offset on value of type bool in /home/jazzing/www/sakesugoroku/wp-content/plugins/pixabay-images/pixabay-images.php on line 34 Notice: Trying to access array offset on value of type bool in /home/jazzing/www/sakesugoroku/wp-content/plugins/pixabay-images/pixabay-images.php on line 34 Warning: Declaration of GreatRealEstateJoiner::sql_join($join) should be compatible with BaseJoiner::sql_join($join, $name, $index, $value, $comparison) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/greatrealestate.php on line 39 Warning: Declaration of SortingComparison::sql_order($order, $field, $value) should be compatible with Comparison::sql_order($order) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/sort-order.php on line 31 Warning: Declaration of SortingComparison::shouldJoin() should be compatible with Comparison::shouldJoin($value) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/sort-order.php on line 27 Warning: Declaration of DB_CustomSearch_Widget::getTitle($params) should be compatible with DB_Search_Widget::getTitle() in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 123 Warning: Declaration of AdminDropDown::getInput() should be compatible with DropDownField::getInput($name, $joiner, $fieldName = NULL) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 452 Warning: Declaration of AdminDropDown::getValue() should be compatible with Field::getValue($name) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 449 Warning: Declaration of AdminDropDown::getHTMLName() should be compatible with Field::getHTMLName($name) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 446 Deprecated: Non-static method DB_CustomSearch_Widget::init() should not be called statically in /home/jazzing/www/sakesugoroku/wp-includes/class-wp-hook.php on line 288 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 4992 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-login.php on line 496 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-login.php on line 512 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 6035 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-includes/pluggable.php on line 934 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-includes/pluggable.php on line 935 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:4992) in /home/jazzing/www/sakesugoroku/wp-includes/pluggable.php on line 936ChatGPT

ChatGPT

The errors and warnings you’re encountering in your WordPress site can be categorized into a few types, each requiring a different approach to resolve:

PHP Notices and Warnings

These are often indicative of issues in the PHP code of your plugins or themes that need to be addressed. They usually do not stop your site from working but should be fixed to prevent potential future errors and to clean up your site’s logs.

  • Trying to access array offset on value of type bool: This warning typically occurs in PHP 7.4 and later versions when trying to access
User

あなた

nihonngodeChatGPT

ChatGPT

WordPressサイトで発生しているエラーや警告は、いくつかのタイプに分類できます。それぞれ異なるアプローチで解決が必要です:

PHPの通知と警告

これらは、プラグインやテーマのPHPコードに問題があることを示していることが多く、解決する必要があります。これらは通常、サイトの動作を停止させるものではありませんが、将来的なエラーを防ぐため、またサイトのログをクリーンに保つために修正すべきです。

  • Trying to access array offset on value of type bool: この警告は、PHP 7.4以降のバージョンで、bool型の変数に対して配列オフセットにアクセスしようとしたときに発生することがあります。これは、変数が予想される配列ではなくfalsenullのような値を持っているときに起こります。この問題を解決するには、該当するコード行を確認し、変数が配列として正しく設定されているか、または配列アクセス前に配列であることをチェックする必要があります。

警告の宣言の不一致

これらの警告は、プラグインやテーマ内のクラスメソッドが予期されるシグネチャと一致しない場合に発生します。PHPでは、継承されたクラスやインターフェースを実装する際に、親クラスやインターフェースで定義されているメソッドのパラメータと戻り値の型が子クラスのメソッドと一致している必要があります。これらの警告を解決するには、不一致の宣言を見つけ、正しいパラメータと戻り値の型に修正する必要があります。

Deprecated(非推奨)の警告

非推奨の関数やメソッドの使用は、将来のバージョンのPHPやWordPressでそのコードが動作しなくなる可能性があることを示しています。非推奨の警告が表示された場合、推奨される新しい方法にコードを更新することを検討してください。

wp_enqueue_scriptの不正な呼び出し

wp_enqueue_scriptwp_enqueue_styleは、wp_enqueue_scriptsadmin_enqueue_scriptslogin_enqueue_scriptsのフック中でのみ呼び出すべきです。これらの関数が正しい場所で呼び出されていない場合、このような警告が発生します。適切なフックを使用してスクリプトやスタイルを登録するように修正してください。

ヘッダー情報の変更ができない

出力が開始された後にヘッダー情報を変更しようとすると、この警告が発生します。これは通常、PHPファイルの最初に余分な空白や改行がある、またはエコーされた出力がある場合に起こります。解決するには、ヘッダー送信前に出力が開始されている場所を特定し、修正する必要があります。

これらの問題を解決するには、WordPressのテーマやプラグインのコードを慎重にレビューし、必要に応じて修正する必要があります。また、カスタムコードを追加する場合

User

あなた

恐らくプラグインの問題だと思うが何のプラグインが問題かプラグイン名だと思われるものだけを列挙しなさい。 Notice: Trying to access array offset on value of type bool in /home/jazzing/www/sakesugoroku/wp-content/plugins/pixabay-images/pixabay-images.php on line 34 Notice: Trying to access array offset on value of type bool in /home/jazzing/www/sakesugoroku/wp-content/plugins/pixabay-images/pixabay-images.php on line 34 Warning: Declaration of GreatRealEstateJoiner::sql_join($join) should be compatible with BaseJoiner::sql_join($join, $name, $index, $value, $comparison) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/greatrealestate.php on line 39 Warning: Declaration of SortingComparison::sql_order($order, $field, $value) should be compatible with Comparison::sql_order($order) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/sort-order.php on line 31 Warning: Declaration of SortingComparison::shouldJoin() should be compatible with Comparison::shouldJoin($value) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/bridges/sort-order.php on line 27 Warning: Declaration of DB_CustomSearch_Widget::getTitle($params) should be compatible with DB_Search_Widget::getTitle() in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 123 Warning: Declaration of AdminDropDown::getInput() should be compatible with DropDownField::getInput($name, $joiner, $fieldName = NULL) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 452 Warning: Declaration of AdminDropDown::getValue() should be compatible with Field::getValue($name) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 449 Warning: Declaration of AdminDropDown::getHTMLName() should be compatible with Field::getHTMLName($name) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/wp-custom-fields-search.php on line 446 Deprecated: Non-static method DB_CustomSearch_Widget::init() should not be called statically in /home/jazzing/www/sakesugoroku/wp-includes/class-wp-hook.php on line 324 Notice: Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 6031 Notice: Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery-ui handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 6031 Notice: Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery-ui-autocomplete handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 6031 Notice: Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the jquery-ui-sortable handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 6031 Deprecated: 関数 has_cap がバージョン 2.0.0 から非推奨になった引数付きで呼び出されました。ユーザーレベルの使用は推奨されていません。代わりに権限を使ってください。 in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 6031 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:6031) in /home/jazzing/www/sakesugoroku/wp-admin/includes/misc.php on line 1431 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:6031) in /home/jazzing/www/sakesugoroku/wp-includes/functions.php on line 7049 Warning: Cannot modify header information – headers already sent by (output started at /home/jazzing/www/sakesugoroku/wp-includes/functions.php:6031) in /home/jazzing/www/sakesugoroku/wp-admin/admin-header.php on line 9ChatGPT

ChatGPT

エラーメッセージに基づいて、問題が発生している可能性があるプラグインは以下の通りです:

  • Pixabay Images
    • pixabay-images/pixabay-images.phpNotice: Trying to access array offset on value of type boolが2回発生しています。
  • WP Custom Fields Search
    • wp-custom-fields-search/bridges/greatrealestate.phpでのWarning: Declaration of GreatRealEstateJoiner::sql_join()の不一致。
    • wp-custom-fields-search/bridges/sort-order.phpでのSortingComparison::sql_order()およびSortingComparison::shouldJoin()の宣言不一致。
    • wp-custom-fields-search/wp-custom-fields-search.phpでのDB_CustomSearch_Widget::getTitle()AdminDropDown::getInput()AdminDropDown::getValue()AdminDropDown::getHTMLName()の宣言不一致。
    • Deprecated: Non-static method DB_CustomSearch_Widget::init()が非推奨として警告されています。

これらのプラグインには複数の問題があり、PHPのバージョン不一致、非推奨の関数の使用、およびWordPressのコーディング基準に準拠していない可能性があることを示しています。これらの問題を解決するためには、プラグインの更新を確認するか、問題を修正するためにプラグインの開発者に連絡する必要があります。また、プラグインを無効にして問題が解決するかどうかを確認することも有効です。

User

あなた

Warning: require_once(/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php): failed to open stream: No such file or directory in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/plugin.php on line 344 Fatal error: require_once(): Failed opening required ‘/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php’ (include_path=’/home/jazzing/www/sakesugoroku/wp-content/plugins/backwpup/vendor/pear/archive_tar:/home/jazzing/www/sakesugoroku/wp-content/plugins/backwpup/vendor/pear/console_getopt:/home/jazzing/www/sakesugoroku/wp-content/plugins/backwpup/vendor/pear/pear-core-minimal/src:/home/jazzing/www/sakesugoroku/wp-content/plugins/backwpup/vendor/pear/pear_exception:.:/usr/local/php/7.4/lib/php’) in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/plugin.php on line 344ChatGPT

ChatGPT

このエラーメッセージは、WP Custom Fields Search プラグインに関連しています。具体的には、wp-custom-fields-search/plugin.phpファイルの344行目でrequire_once関数を使用してファイルを読み込もうとした際に、指定されたパスにファイルが存在しないために発生しています。

エラーメッセージ:

  • Warning: require_once関数が/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.phpファイルを開くことに失敗しました。これは、ファイルが存在しないか、パスが間違っている可能性があります。
  • Fatal error: 必要なファイルが存在しないためにスクリプトの実行が停止しました。

この問題を解決するためのステップは以下の通りです:

  1. ファイルの存在確認:指定されたパスにファイルが本当に存在しないか確認してください。ファイルが削除されているか、移動された可能性があります。
  2. プラグインの再インストール:ファイルが見つからない場合、プラグインが正しくインストールされていない可能性があります。プラグインを一度削除し、再インストールすることで問題が解決するかもしれません。
  3. プラグインの開発者に連絡:上記のステップで問題が解決しない場合、プラグインの開発者に問題を報告してサポートを求めることをお勧めします。ファイルが欠落しているか、互換性の問題がある可能性があります。
  4. 代替プラグインの検討:もし、このプラグインが必要な機能を提供している唯一のものでない場合、代わりになるプラグインを検討することも一つの選択肢です。

このエラーは、プラグインが依存しているファイルやリソースが適切に配置されていないことを示しているため、サイトの管理者はこれを重視し、迅速に対処する必要があります。

User

あなた

Warning: require_once関数が/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.phpファイルを開くことに失敗しました。これは、ファイルが存在しないか、パスが間違っている可能性があります。 Fatal error: 必要なファイルが存在しないためにスクリプトの実行が停止しました。ChatGPT

ChatGPT

存在しないファイルをrequire_onceで読み込む際にエラーを無視し、強制的にスクリプトの実行を続行させるのは一般的に推奨されません。これは、そのファイルがプログラムの実行に必要な機能を提供している可能性があるため、無視することで予期せぬエラーや機能の不具合を引き起こす可能性があります。

しかし、特定の状況で実行を続行させる必要がある場合は、require_onceinclude_onceに変更することで、ファイルが存在しない場合に致命的なエラーを発生させずに済みます。include_onceは、ファイルが存在しない場合に警告を出すだけで実行は続行されます。ただし、これにより発生する可能性のある問題には注意してください。

以下のようにコードを変更します:

phpCopy code

// 以前のコード require_once('/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php'); // 変更後のコード @include_once('/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php');

@オペレーターを使用して、エラーメッセージを抑制することもできますが、これはデバッグを困難にするため、開発プロセスでは推奨されません。可能であれば、問題の根本原因を解決する方法を探求することをお勧めします。

もし、このファイルが不要である、または別の方法で機能を代替できると確信がある場合は、プラグインのコードからこの行を安全に削除することも考慮してください。ただし、この変更を加える前に、プラグインのバックアップを取ることを忘れないでください。

User

あなた

どこにあるコードを変えるのですか?ChatGPT

ChatGPT

指示されたコードの変更を行うには、WordPress サイトのファイルシステムにアクセスして、特定のプラグインの PHP ファイルを編集する必要があります。この場合、wp-custom-fields-search プラグイン内の plugin.php ファイルを編集する必要があるようです。手順は以下の通りです:

  1. FTP クライアントを使用するか、あるいは ホスティング コントロール パネルのファイルマネージャー機能を使って、WordPress サイトのファイルシステムにアクセスします。
  2. wp-content/plugins/wp-custom-fields-search/ ディレクトリに移動します。
  3. plugin.php ファイルを見つけて開きます。テキストエディター(Notepad++、Sublime Text、または VS Code など)を使用すると、ファイルをより簡単に編集できます。
  4. ファイル内で以下の行を探します(エラーメッセージによると、344行目のようです):phpCopy coderequire_once('/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php');
  5. この行を以下のように変更します:phpCopy code@include_once('/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php');
  6. ファイルを保存し、変更をサーバーにアップロードします。

注意:直接プラグインのコードを変更することは、プラグインが更新された場合に変更が上書きされるリスクがあるため、推奨される方法ではありません。可能であれば、プラグインの作者に問題を報告し、公式な修正を待つか、またはプラグインを変更するための子プラグインやフックを使用する方法を検討してください。

また、ファイルやディレクトリのパスが異なる可能性があるため、実際のパスを確認してください。変更を行う前に、サイトとデータベースの完全なバックアップを取得することを忘れないでください。

User

あなた

334行目はこれのようです wp_enqueue_script( “wpcfs-editor”, plugin_dir_url(__FILE__).’js/wp-custom-fields-search-editor.js’, array(‘jquery’,’jquery-ui-core’,’jquery-ui-widget’,’jquery-ui-sortable’,’angularjs’,’ng-sortable’)

2 / 2ChatGPT

ChatGPT

指定されたエラーメッセージとファイルの行内容に鑑みると、エラーが発生している箇所の特定に誤りがあったようです。提供された情報に基づくと、require_onceでエラーが発生している箇所は、実際には別の場所にある可能性が高いです。

require_once が失敗しているのは migrate-from-legacy-plugin.php を読み込もうとしたときで、このファイルは plugin.php の中でどこかで呼び出されているはずです。wp_enqueue_script の部分はJavaScriptファイルをキューに入れる処理であり、直接の問題とは関連していません。

そのため、require_once でファイルを読み込む部分を探して、そこを @include_once に変更することでエラーが発生しても処理を続行するように変更する必要があります。ただし、先程指摘した行番号はエラーに関連する部分ではないため、plugin.php ファイル内を検索して、実際に require_once を使用して migrate-from-legacy-plugin.php ファイルを読み込んでいる箇所を見つける必要があります。

ファイル全体を確認して、以下のような行を探してください(行番号は異なる可能性があります):

phpCopy code

require_once('/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php');

この行を見つけたら、以下のように変更してください:

phpCopy code

@include_once('/home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/migrations/migrate-from-legacy-plugin.php');

もし plugin.php ファイル内にそのような行が見つからない場合、別のファイルに記載されている可能性があります。その場合、migrations ディレクトリや他の関連ファイルも確認してみてください。

重要なのは、プラグインのファイル構造やどのファイルが問題のコードを含んでいるかを理解することです。WordPress サイトにカスタムコードを追加する際には、常に慎重に行い、変更前にはバックアップを取るようにしてください。

User

あなた

require_onceがあるのは以下の9箇所です。どれでしょうか。 require_once(dirname(__FILE__).’/functions.php’); if($submitted){ require_once(dirname(__FILE__).’/engine.php’); $index = 0; foreach($submitted[‘inputs’] as $k=>&$input){ function widgets_init(){ require_once(dirname(__FILE__).’/widget.php’); register_widget(“WPCustomFieldsSearchWidget”); wp_enqueue_style(“wpcfs-form”,plugin_dir_url(__FILE__).’templates/form.css’); function upgrade_plugin($old_version,$latest_version){ if(!current_user_can(‘manage_options’)) return; if(!$old_version){ require_once(dirname(__FILE__).’/migrations/migrate-from-legacy-plugin.php’); wpcfs_upgrade_3_x_to_1_0(); function wp_custom_fields_search_inputs($inputs){ require_once(dirname(__FILE__).’/engine.php’); $inputs = $inputs + array( new WPCustomFieldsSearch_TextBoxInput(), new WPCustomFieldsSearch_SelectInput(), new WPCustomFieldsSearch_CheckboxInput(), new WPCustomFieldsSearch_RadioButtons(), new WPCustomFieldsSearch_HiddenInput(), function wp_custom_fields_search_inputs($inputs){ require_once(dirname(__FILE__).’/engine.php’); $inputs = $inputs + array( new WPCustomFieldsSearch_TextBoxInput(), new WPCustomFieldsSearch_SelectInput(), new WPCustomFieldsSearch_CheckboxInput(), new WPCustomFieldsSearch_RadioButtons(), new WPCustomFieldsSearch_HiddenInput(), ); return $inputs; } function wp_custom_fields_search_datatypes($datatypes){ require_once(dirname(__FILE__).’/engine.php’); $datatypes = $datatypes + array( new WPCustomFieldsSearch_PostField(), new WPCustomFieldsSearch_CustomField(), new WPCustomFieldsSearch_Category(), new WPCustomFieldsSearch_CustomTaxonomy(), new WPCustomFieldsSearch_Tag(), ); return $datatypes; } function wp_custom_fields_search_comparisons($comparisons){ require_once(dirname(__FILE__).’/engine.php’); $comparisons = $comparisons+array( new WPCustomFieldsSearch_Equals(), new WPCustomFieldsSearch_TextIn(), new WPCustomFieldsSearch_GreaterThan(), new WPCustomFieldsSearch_LessThan(), new WPCustomFieldsSearch_Range(), new WPCustomFieldsSearch_SubCategoryOf(),ChatGPT

ChatGPT

エラーメッセージに基づいて、問題となっている require_once の呼び出しは以下の箇所になります:

phpCopy code

function upgrade_plugin($old_version,$latest_version){ if(!current_user_can('manage_options')) return; if(!$old_version){ require_once(dirname(__FILE__).'/migrations/migrate-from-legacy-plugin.php'); wpcfs_upgrade_3_x_to_1_0();

このコードは、プラグインの以前のバージョンから最新バージョンへの移行を処理する部分で使用されています。エラーメッセージが指しているのは、migrate-from-legacy-plugin.php ファイルを読み込もうとしたときに、そのファイルが存在しないために発生しています。

問題を回避するために、この特定の require_once の行を @include_once に変更することができます。変更後のコードは以下のようになります:

phpCopy code

function upgrade_plugin($old_version,$latest_version){ if(!current_user_can('manage_options')) return; if(!$old_version){ @include_once(dirname(__FILE__).'/migrations/migrate-from-legacy-plugin.php'); wpcfs_upgrade_3_x_to_1_0();

この変更により、ファイルが見つからない場合でもスクリプトの実行が続行されますが、migrate-from-legacy-plugin.php ファイルが本来果たすべき役割や機能が失われる可能性があるため、注意してください。最適な解決策は、ファイルがなぜ存在しないのかを理解し、必要に応じてプラグインの作者に連絡するか、またはファイルを正しい場所に復元することです。

User

あなた

変更したら以下のエラーが出ました。 Fatal error: Uncaught Error: Call to undefined function wpcfs_upgrade_3_x_to_1_0() in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/plugin.php:345 Stack trace: #0 /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/plugin.php(333): WPCustomFieldsSearchPlugin->upgrade_plugin() #1 /home/jazzing/www/sakesugoroku/wp-includes/class-wp-hook.php(324): WPCustomFieldsSearchPlugin->admin_init() #2 /home/jazzing/www/sakesugoroku/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #3 /home/jazzing/www/sakesugoroku/wp-includes/plugin.php(517): WP_Hook->do_action() #4 /home/jazzing/www/sakesugoroku/wp-admin/admin.php(175): do_action() #5 /home/jazzing/www/sakesugoroku/wp-admin/plugins.php(10): require_once(‘/home/jazzing/w…’) #6 {main} thrown in /home/jazzing/www/sakesugoroku/wp-content/plugins/wp-custom-fields-search/plugin.php on line 345ChatGPT

ChatGPT

この新たなエラーは、migrate-from-legacy-plugin.php ファイルが存在しないために、wpcfs_upgrade_3_x_to_1_0 関数が未定義であると報告しています。@include_once を使用しても、このファイルが必要とする関数が読み込まれないため、エラーが発生します。

この問題を解決するために、wpcfs_upgrade_3_x_to_1_0 関数の呼び出しを条件付きで実行する必要があります。これは、関数が定義されているかどうかをチェックし、定義されていない場合は実行をスキップすることで達成できます。

以下のようにコードを変更してください:

phpCopy code

function upgrade_plugin($old_version,$latest_version){ if(!current_user_can('manage_options')) return; if(!$old_version){ @include_once(dirname(__FILE__).'/migrations/migrate-from-legacy-plugin.php'); if(function_exists('wpcfs_upgrade_3_x_to_1_0')){ wpcfs_upgrade_3_x_to_1_0(); } } }

この変更により、wpcfs_upgrade_3_x_to_1_0 関数が存在する場合にのみ実行されるようになります。これにより、ファイルが見つからない場合や関数が未定義の場合に発生するエラーを防ぐことができます。

ただし、このアプローチはエラーを回避するための一時的な修正であり、プラグインが期待する機能が失われる可能性があることを理解しておくことが重要です。長期的な解決策としては、プラグインの開発者に問い合わせてサポートを求めるか、必要なファイルや更新を正しく行うことです。

この記事が良いと思ったら

15円からのご支援で、モチベーションが上がります。

Amazonほしい物リスト

日記
スポンサーリンク
シェアする
酒すごろくをフォローする
スポンサーリンク
スポンサーリンク
酒すごろく

コメント