That code doesn’t look like it conforms to the current Widgets API. Perhaps your problem is related?
First potential issue: your class test
should be plugin-slug-test
, in order to avoid naming conflicts.
Second potential issue: the only functions inside of your WP_Widget extending class should be:
- function plugin-slug-test() {}
- function widget( $args, $instance ) {}
- function update( $new_instance, $old_instance ) {}
- function form( $instance ) {}
You need to move your add_action()
calls outside of your Widget class.
Third potential issue: why do you declare all of your Widget class functions to be public?
Fourth potential issue: I don’t think you need to declare new Test();
for a Widget class.
Related Posts:
- Add content to footer – above wp_footer
- Some Widgets in the Right Side Bar and the whole Footer section is not working in a WordPress Site
- Footer option is missing in Customiser
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- How to enable edit button in the theme’s customize UI?
- How can I make my custom shortcode work in a Custom HTML Widget?
- Delete Custom Dashboard Widgets
- How to pass JavaScript variable to PHP in wordpress widget?
- How To Add an Extra Field in All WordPress Available Widgets?
- Using the media uploader in a custom plugin
- Has anyone been able to get the aweber plugin to work
- How to create a widget or plugin to add custom content to my website?
- WordPress widget / plugin….fields not appearing in my widget
- Share buttons on article footer
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- How can I retrieve data within my widget
- How to unregister a widget from a child theme
- How to exclude a widget from page 1 of a paginated post
- Strip HTML comments from plugins in header/footer
- How to get popular post from across a network?
- Are there plugins that interfere with the admin part of Rss widget?
- how can i limit the number of instances for my widget
- Dashboard Widget Form
- I need some direction on how to have a sidebar based on meta rather than page
- How can I reuse the WordPress search form for a custom plugin / widget?
- Multisite Widget/Content
- Passing $this->get_field_name() to javascript
- Is there plugin to show recent posts from one website in the widget area of another?
- Can I use a form in a dashboard widget?
- Ajax gives 400 error
- Missing argument 3 for wp_register_sidebar_widget()
- The called constructor method for WP_Widget in GFWidget is deprecated since version 4.3.0! Use
- Problem in loading javascript in footer
- I wrote my plugin. How to display the result of the plugin’s function to sidebar (widget?)?
- How to check if you are on widget.php page?
- I have no idea “How change font for elements in widget?”
- How to save additional user data as part of the registration process?
- Theme’s default styles are overriding my plugin’s custom CSS
- Adding widgets to header and footer from plugin
- Rotate Widgets or Content Blocks every x sec/min
- Do widget options need to be escaped widget()?
- Ajax contact form widget plugin data not insert in database
- How to remove traces from widget during uninstallation
- Which widget to use for display category post with view more? [closed]
- WordPress Widget Not Saving Data
- In the archive widget, how do I sort in between two years?
- Wysiwyg editor errors
- How to make WordPress customizable for clients
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- Conditional tag in Widget Logic for checking if top level page or if subpage
- Char limit on custom blog-post form? [closed]
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- How to add Wrapper Div/container element around WordPress Widget Content
- Disabling plugin but wpenqueue is not available
- Related posts widget or plugin needed
- Problem since update 3.5 [duplicate]
- How to disable a widget when dependent plugin is inactive?
- How can I delete a wordpress widget instance?
- Saving widget options from class method
- How to handle forms from sidebar widgets – Processing $_POST variables using get_field_name()
- Short messages widget [closed]
- Widget’s container?
- PHP Warning: Declaration of aec_contributor_list::form() should be compatible with WP_Widget::form($instance)
- Updating WordPress plugin admin panel footer text
- WordPress Widget Not Saving Instance
- How to display a widget on a page with no theme?
- Widget where it can make changes to the container
- Widget content turns up before title
- Javascript from Easy-Fancybox place into footer
- Modify pages widget and make a plugin?
- Hook for plugin to insert into entry-meta
- jQuery slider widget similar to cnet.com
- Why aren’t my Follow Me links working?
- Is there any plugin to show number of clicks on the link?
- Creating New Dynamic Fields for a Certificate (Number Generation, Code Referencing, and more)
- co-authors plugin – inline listing
- Change language in SiteOrigin Widgets
- elementor development – custom widget like an inner section widget
- The styles in the recent posts widgets plugin not working
- Using foreach loop for `$instance` of form and update array widget iteration
- How to disable a widget area of a specific page?
- One time call to external API in widget
- Registered sidebar area is not shown from plugin.
- Custom content per post in widget
- Using slightly modified widget
- How to make wp multisite subdomain exist search
- Custom Widget not Available after Plugin Installation
- Adding link on title its in description but not in title see screenshots attached
- Plugin Works, but Widget Doesn’t
- Best use adding user generated JS/CSS to a theme with a plugin
- Widget Script Loads at Bottom of Page
- Use of apply_filter in plugin/widget class
- Widget redirecting to home page
- Plugin won’t activate, fatal error (widget class not found)
- WordPress plugin not eching popular posts
- Trying to output a “Most visited blogs” list in wordpress multisite
- How to use template field in the Event Organiser plugin widget
- Move specific javascript to the footer
- Can not add jquery in footer
- Is it possible to control content on different pages by checkboxing wich content is shown where on a wordpress theme page?