You can get widget options using following code
$current_widget_options = $this->get_settings();
This will return array like array(instance number => settings)
. Instance number refers to the $number
of widget.
Example: If your widget instance number is 2
then your required options will be at $current_widget_options[2]
Alternative:
As get_settings()
is deprecated, you can use get_option
. Check following example:
$widget_options_all = get_option($this->option_name);
$options = $widget_options_all[ $this->number ];
Related Posts:
- How can I use the built in WordPress “browse link” functionality?
- Modifying the default search widget
- Why is the $old_instance needed for the widget update function?
- Get sidebar parameters (before_widget, before_title, etc.) from within a widget
- How to add image uploader to a custom widget?
- How to add color picker to widgets?
- How to delete cached transients from a widget instance properly?
- What is this instance variable doing in the Widgets class
- Remove All Widgets from Sidebar
- Unregistering a Sidebar in Child Theme
- Problems with the sidebar args and wp_list_bookmarks
- Ban certain widgets from certain sidebars
- How to use jQuery on widget admin page
- How could a Widget behave differently depending on sidebar
- jQuery does not work in widget backend
- iris color picker in widget – click event doesn’t fire when initially when widget is first created
- Custom widget using get_categories select menu dropdown
- Find if widget block is active
- Elegantly using JavaScript on widget admin forms
- Widget queries even when there are no sidebars?
- Multiple users editting widgets
- How to rename wordpress Widget
- How to hack recent comments default widget?
- Recent Posts widget without Title
- Pre-install widgets in WP-Admin
- How to change plugin`s template (view) correctly?
- Showing a Thickbox (tb_show) does nothing
- How do I add a widget from an Android phone?
- Error gets thrown when calling require_once on widget.php
- How to activate or install the Gallery Widget?
- Custom User Field in Dashboard Widget
- Getting a div wrapped around two widgets
- How to create a widget that accepts html input?
- Widget changes in customizer ajax error to many options?
- How to Add TinyMCE to widget
- How can I get the first section of a page 100% width, while the rest will have a sidebar? [closed]
- Widgets not adding div on before and after title
- Dynamically add content to an existing widget area
- Simple widget causing whitescreen
- How to stop comments widget conflicting with theme comments
- How do I create a widget to embed the code for a sign up form, so that the sign up form appears on every page?
- Tabs and Category Widget
- How to change the default class for the widget title?
- How to add the same widget twice?
- How to hide widget if current category has no posts assigned to it?
- ‘is_author()’ logic in widget for author only
- Unable to load “wpColorPicker” on theme customize page
- Undefined Variable in my widget
- Update widget form after drag-and-drop “only specific plugin”
- Recent Comments from Specific Category Widget
- Different sidebars not changing
- Placing a widget with $wpdb query
- How to make widget appear conditionally
- Ampersand breaking Widget title
- How to allow editing of text in sidebar?
- Shortcode into widget
- Want to add more option in “Sexy Login”
- How to show avatar of current logged in user in a widget
- Got a problem with a widget
- Widget control – putting a slideshow in the widget area
- How do I find out which
- How to update a widget data?
- custom widget not saved to sidebar
- When editing in block editor, the post/article gets under the floating widgets
- Recently changed domain name. Home page widgets are now not in the customize menu yet still being on the page
- Is it possible to dynamically output the name of the widgets?
- I accidentally added a widget area called sidebar 1
- wp_registered_widgets doesn’t contains my widgets
- How can I write this code snippet so that it echo’s the response when submitting empty fields?
- What is the difference between widget object and widget instance?
- Apply two different styles to Wiget Titles along with a decorative line
- My plugin works in home page, but doesn’t work in post page
- Widget text color change
- Widget to embed youtube video
- How to make featured area?
- Checking if widget has title not working
- wp_list_categories + widget
- How can I add widgets to the category page?
- How to create another widgets.php page
- Remove default WordPress widgets
- widget that will do shortcodes that user inputs
- Disable wordpress widget automatically on error
- Can I add a widget to the of my site?
- Widget dynamically add new input field
- How to show widget in frontend?
- WordPress function breaks widget’s markup?
- Registering multiple copies of a widget
- How do I stop out of stock items from appearing on my WooCommerce site when using the Layered Nav widget [closed]
- Single Widget Multi Sidebar
- An issue with register_sidebar and the admin interface
- page url in shortcode
- iframe/embed vid in text widget loads outside container and moves around when scrolling the page?
- Add text to Text Widget using Javascript
- Widget on home page displays wrong time compared to same widget on inside pages
- Subpages menu on sidebar plus widgets
- Widgets in PHP files?
- Text Widget Not Working
- Sample widget code which get data(1-5 record) from Wp_Admin panel and display to Homepage(WordPress Custom Theme)
- Widget block editor: Unable to collect checkbox values inside widget update() method
- Theme Widget Area Defaults