Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 在自定义函数中获取小部件实例_Wordpress - Fatal编程技术网

Wordpress 在自定义函数中获取小部件实例

Wordpress 在自定义函数中获取小部件实例,wordpress,Wordpress,有没有一种方法可以在自定义的\u widget\u init函数中获取widget$instance变量值 public function __construct() { .... add_action( 'wp_head', array( __CLASS__, 'custom_widget_init' ) ); } function custom_widget_init() { } 你为什么要这么做?任何具体原因都可能有其他解决方案,我需要动态更改样式

有没有一种方法可以在自定义的\u widget\u init函数中获取widget$instance变量值

public function __construct() {
  ....
  add_action( 'wp_head', array( __CLASS__, 'custom_widget_init' ) );           
}

function custom_widget_init() {   

}

你为什么要这么做?任何具体原因都可能有其他解决方案,我需要动态更改样式。