Linked Questions

86
votes
37answers
11k views

Objective Best Practices for Plugin Development? [closed]

Starting a community wiki to collect up objective best practices for plugin development. This question was inspired by @EAMann's comments on wp-hackers. The idea is to collaborate on what objective ...
6
votes
2answers
7k views

How do I create a custom role capability?

I wish to create a custom capability for accessing the interface of my plugin. Should the plugin manage adding this capability to all the administrator accounts on activation? If so: Does WordPress ...
5
votes
1answer
323 views

Uninstall script for a plugin in Multisite

I've just realized that the traditional uninstall.php file along a plugin is not working in Multisite. if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) exit(); delete_option( 'plugin_option_name' ); ...
4
votes
1answer
129 views

Changing the “Plugin Activated” Message Default

Whenever an administrator in WordPress activates a plugin, upon the reload of the plugin page, a notice will appear upon successful activation reporting "Plugin Activated". Is there a way to change ...
4
votes
2answers
375 views

Popup asking whether data should be removed on plugin uninstall

I have a plugin which creates some options in wp_options, but also creates custom post types and is used to populate that post type. Upon install it makes sense to remove the data in wp_options, but ...
3
votes
2answers
849 views

Show a confirm message before plug-in activation

I want to display a message when the user try to activate my plugin. This message will ask if him really wants to activate the plugin or, if him change his mind, cancel the activation. How can I ...
3
votes
1answer
100 views

How can I import a class privately into a plugin?

I've written a Wordpress plugin that makes use of a simple controller/templating library I have authored, to separate out business logic from presentation. I have a (slightly theoretical) query about ...
3
votes
2answers
138 views

Can I use traits? Or will I cut out a large portion of the community?

If I restrict my theme framework to 5.4+ (min 5.4) php how much of the average community am I cutting out? All just so I can use traits to help with some inheritance issues I ran into in this question ...
2
votes
1answer
528 views

How to delete terms on plugin deactivate?

I created a list of terms under 'category' when activate plugin. When deactive the plugin, I want to delete them. My function doesn't work, how to make this working? function ppcontent_deactivate() { ...
2
votes
2answers
337 views

Is it appropriate to remove custom posts and terms on plugin uninstall?

This is more of a "best practices" than a question, but I was wondering, what to people typically remove when their plugin is removed? I have a plugin that does the following: registers custom post ...
1
vote
3answers
2k views

Problem creating a table with dbDelta

I'm working on a plugin that was creating a table successfully. However, I decided to test it in a fresh install of Wordpress (on my local server) and now the table is not being created in my ...
1
vote
3answers
221 views

Save Plugin Version Number as Option?

I seem to recall seeing a tip somewhere saying that it was a best practice to save a plugin's version number as an option. I'm working through releasing a plugin, and I'm considering whether to do it, ...
1
vote
1answer
71 views

How to include a file for admin and 2 pages without being loaded on other parts of the site?

I need to include a file twice. once in admin, another in its component. if( is_admin() || is_the_component() ) require... But, there's a big function in the class for registering stuffs is only ...
1
vote
1answer
110 views

admin_notices after register_uninstall / deactivate_hook

I've successfully added admin notices to display on register_activation_hook, and when the plugin updates, but I'm not seeing any way to display admin_notices after the uninstall or deactivation ...
1
vote
2answers
433 views

how to refresh wordpress permalink settings? (without admin panel)

I changed permalinks in wp_options table in database and I'm getting 404 on every post. Everything works fine after I log in into the panel and click "save settings" on permalinks options page. How ...

15 30 50 per page