Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How can you create an empty plugin which have basic options like activate, deactivate etc.?



How can you create an empty plugin which have basic options like activate, deactivate etc.?..

Answer / Yogesh Rani

To create an empty plugin in WordPress, first navigate to your wp-content/plugins directory and create a new folder with the desired name (e.g., my-plugin). Inside this folder, create two files: my-plugin.php and my-plugin.php-dist. The active plugin PHP file (my-plugin.php) should be empty for now. Next, add the following code to the bottom of your wp-config.php file to register the new plugin:nn```phpndefine('MY_PLUGIN', trailingslashit(WP_CONTENT_DIR) . 'plugins/my-plugin');nrequire_once MY_PLUGIN . 'my-plugin.php';```nnAfter registering the plugin, create a skeleton structure in my-plugin.php for basic activation and deactivation functions:nn```phpn<?phpnn/*nPlugin Name: My PluginnDescription: An empty WordPress plugin.nVersion: 1.0nAuthor: Your Namen*/nn// Activate Functionnregister_activation_hook(__FILE__, 'my_plugin_activate');nfunction my_plugin_activate() {n}nn// Deactivate Functionnregister_deactivation_hook(__FILE__, 'my_plugin_deactivate');nfunction my_plugin_deactivate() {n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More WordPress Interview Questions

How many pages wordpress can handle?

1 Answers  


Explain me when you will use endif function to end the condition statement?

1 Answers  


How do u start a blog?

1 Answers  


How do I migrate my wordpress site?

1 Answers  


Can deactivated plugins slow down a wordpress website?

1 Answers  


Does wordpress have seo?

1 Answers  


How do I create a post in wordpress?

1 Answers  


How to Generates a random password of the specified length in WordPress?

1 Answers  


What is WordPress loop?

1 Answers  


Explain the difference between characters 35 and x35?

1 Answers  


Will comparison of string "10″ and integer 11 work in PHP?

1 Answers  


How do I restore my wordpress theme?

1 Answers  


Categories