Is creating a new plugin necessary when creating a custom widget in wordpress?

I am following a tutorial on creating a custom widget and it is doing it by placing it into a new custom plugin.

My question is the next: do I actually need/ is advisable to create a custom plugin to create the custom widget?

Thank you in advance!


You can create a widget in either a THEME or PLUGIN.

If you think there will be a need to keep the data in the widget while changing to a different theme, then it should be a plugin. If the widget is very specific to your theme, then it should stay with the theme.

Similar questions

Should a SEO plugin be necessary?
I'm using the All in One SEO plugin for my site. The extra fields and options it supplies seem like they could be handled via a theme, possibly negating the use for a plugin. Should SEO considerations be handled by a theme, rather than delegating the work to a separate plugin? It could reduce maintenance issues, takes up less space, and be more int...
Is the SEO plugin necessary?
I want to understand how wordpress is structured in the first place with regard to search engine friendliness. Isn't it set up for SEO by default? Is the SEO plugin necessary then? and to what extent does post name in the url make a difference as against the standard numerical format of wordpress urls?
What is necessary to secure a WP plugin against direct file access attempts?
When developing a WordPress plugin, what are the best practices for securing the plugin against attempts to directly access the file? I've seen WordPress plugins use a range of options, from .htaccess files within plugin directories to having empty index.php files in each directory to having each included file give an error if loaded directly (for ...
Is a Virus detection plugin necessary?
Nowdays a Virus detection plugin is necessary for Wordpress? EDIT: I mean to prevent attacks and violations... for example i'm using this plugin: and i recive daily emails about some "Login Failures" using "admin" as Username and some differents passwords from a lot of different IP...
Plugin development: is adding empty index.php files necessary?
When developing a plugin, should I includes the blank index.php file and then add my functions in the plugin-name.php? Or is that unnecessary? What file structure is recommended? This? Or this? From doing some research on WPSE, I have found a Q&A related to my own question: However, this question is over four years ago and I wanted to know if t...
How to get "Widget Logic" plugin's input value in a custom widget code (to display on the Widget admin page)
I've got the "Widget Logic" plugin installed. I have created my own widget called "Buzz". I have a sidebar with multiple instances of my custom widget "Buzz". Now, on the Widgets admin page when a sidebar is toggled open and all of the widgets in that sidebar are closed up, you can see a widget name and widget instance title (if one is specified). ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.