とあるテーマの create_function を使っているファイルでエラーが発生しました。
そのファイルで修正した箇所は以下の2つです。
1.create_functionの修正
|
1 |
add_action('widgets_init', create_function('', 'return register_widget("ml_ad_widget");')); |
を
|
1 |
add_action('widgets_init', function(){register_widget('ml_ad_widget');}); |
2.コンストラクタの修正
|
1 2 3 4 5 6 7 8 9 |
<?php class ml_ad_widget extends WP_Widget { function ml_ad_widget() { $widget_ops = array( 'classname' => 'ml_ad_widget', 'description' => __('Show AdSense at random in front page.','tcd-w') ); $control_ops = array( 'id_base' => 'ml_ad_widget' ); parent::__construct( 'ml_ad_widget', __('AdSense (tcd ver)','tcd-w'), $widget_ops, $control_ops ); } |
を
|
1 2 3 4 5 6 7 8 9 |
<?php class ml_ad_widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'ml_ad_widget', 'description' => __('Show AdSense at random in front page.','tcd-w') ); $control_ops = array( 'id_base' => 'ml_ad_widget' ); parent::__construct( 'ml_ad_widget', __('AdSense (tcd ver)','tcd-w'), $widget_ops, $control_ops ); } |
コンストラクタの修正について言及している記事が中々見つからないので盲点です。参考になれば幸いです。




![【WordPressトラブル解決】[Public Post Preview]を有効化すると記事の新規追加が出来ない](https://pct.unifas.net/wp-content/uploads/2019/11/2019-11-25_152346-1024x199.png)

