WordPress插件开发-获取所有活动的小部件 [英] Wordpress plugin development - get all active widgets
问题描述
我正在开发一个wordpress插件,该插件创建一个可以作用于另一个小部件的小部件.我进行了搜索,但似乎找不到(如果存在)一个钩子,该钩子将提供小部件的所有活动实例的详细信息.如果您遇到任何帮助,将不胜感激.谢谢
I am developing a wordpress plugin that creates a widget that would act upon another widget. I have searched but cant seem to find (if it exists) a hook that would give details of all active instances of widgets. any help would be appreciated if you have come across this. thanks
推荐答案
get_option('sidebars_widgets')
为您提供一个关联数组,其中包含每个侧边栏的小部件列表以及所有非活动小部件的列表.
get_option('sidebars_widgets')
gives you an associative array that contains a list of widgets for each sidebar plus a list of all inactive widgets.
get_option('widget_widgetname')
将为您提供一个关联数组,其中包含小部件所有实例的设置.
get_option('widget_widgetname')
will give you an associative array that contains the settings of all instances of your widget.
这篇关于WordPress插件开发-获取所有活动的小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!