-2
votes
1answer
28 views

Why haven't I see plugins using get_file_data to handle retrieving plugin version?

In terms of best practices, I'm curious as to why I haven't seen anyone using get_file_data or get_plugin_data to handle getting a plugin version (for versioning CSS/JS files). Many quality plugins do ...
10
votes
1answer
452 views

How to create an API for my plugin?

I have been developing plugins for WordPress, most plugins I have developed use two or three classes, hence not as huge as Buddypress or WooCommerce. I am planning to develop two open source plugins ...
17
votes
2answers
464 views

Is it ever okay to include inline CSS in plugins?

Normally in a plugin I would add styles using wp_enqueue_style. However, I am currently creating a plugin that only needs a few lines of CSS and I am wondering if it might be better to serve the ...
5
votes
1answer
229 views

Optimize shortcode callbacks

I created a plugin to add some shortcodes in my WordPress site. But I'm a PHP newbie, so I believe it may have some errors or ways to optimize it. It's working fine, and apparently there are no ...
5
votes
3answers
509 views

Best way to abort plugin in case of insufficient PHP version?

You write a plugin which requires PHP 5.1. Someone tries to install it on a server with PHP 4. How do you deal with that in a safe and user-friendly manner?
1
vote
2answers
95 views

Failed to invoke other hook from the init hook

Related to this question (Use wp init hook to call other hooks?) but not the same. Sometimes, I found that the hook will failed to run when I place inside the init hook, e.g. Not Work: ...
1
vote
1answer
40 views

Where to store the name of a custom table?

I'm extending the $wpdb object with properties for my custom tables. function setup_wpdb() { global $wpdb; // Create properties for custom tables $wpdb->my_plugin_table1 = ...
0
votes
1answer
209 views

Create Widget or Enable Shortcodes in Sidebar

I'm well aware that WordPress by default does not process shortcodes in the sidebar. My question is why. I'm building a very small plugin that exports some content when the shortcode is present. This ...
14
votes
2answers
447 views

In Which Contexts are Plugins Responsible for Data Validation/Sanitization?

I want to make sure all of the data in my plugins/themes is handled securely before entering the database and before being output to the browser. My problem is that there are situations where the API ...
0
votes
3answers
1k views

Loading Modernizr (or other JavaScript libraries) for use in a plugin

Download a copy of Modernizr, put it in your plugin’s directory and simply enqueue the script whenever needed. Done. The problem is that Modernizr may already be loaded by another plugin. You ...
3
votes
2answers
100 views

Which to use to execute code during the saving of a plugin settings page?

I'm writing a plugin with a settings/option page and I want some php code to be executed whenever someone saves the settings on that page and that page alone. Which actions do I need to hook into to ...
1
vote
2answers
203 views

Applying OO patterns and principles to plugin development

I'm busy writing my first plugin, using PHP 5.3.5. I come from a C# environment, and I must say I'm more than happy with the level of support for good, solid OOP techniques in PHP. However, I'm a ...
4
votes
4answers
1k views

Where to put third party PHP library?

I'm developing a couple of open-source plugins and a theme (all part of a "suite") that all use the same third party PHP library. I'm wondering what is the best way to include it in Wordpress. Here ...
1
vote
1answer
64 views

How would I go about creating a user ranked post popularity page?

I currently run a music blog using Wordpress as my CMS and i'm looking to redesign the site in the very near future. Part of my plan for the redesign is to try and integrate a user ranking system for ...
2
votes
1answer
443 views

When to check if a function exists

I've just started developing a WP plugin, and i've been reading some code from other plugins as a way to get started. I've seen a couple of plugins that wrap all or some of their functions in the ...
9
votes
1answer
3k views

Plugin Form Submission Best Practice

I have done a lot of researching and haven't found quite what I am looking for, so I am hoping that I can be pointed in the right direction. I am developing an Events plugin that will book a ticket ...
3
votes
2answers
106 views

WordPress Plugin as 'Library' From Abstract Application?

Here is my thought, and I could be digging myself a huge hole. That's why I'm here ;) I am looking to develop a complex application but I want this application to run both as a standalone script as a ...
14
votes
4answers
2k views

Plugins in symlinked directories?

When I develop plugins I test them on multiple versions of WordPress by symlinking my plugin directory in the different wp-content directories. This is great since I only have to edit the files once, ...
7
votes
2answers
5k views

How do i best handle custom plugin page actions?

I'm constantly running into the same annoyance, so i thought i'd see if there's any ideas or experience out there... I've created a plugin that uses it's own admin page. It has to. Now that i sorted ...
0
votes
1answer
283 views

unregister a sidebar widget

The codex says it is depreciated. As a long time plugin user, I know how annoying it is when plugins don't clean up after themselves, is it's deprecation indication that it is necessary?
0
votes
2answers
310 views

How to determine which capability to use?

For example, I want to use add_menu_page() function to add a menu item to the dashboard. To control which users will be able to access it, I'm supposed to use capabilities... <?php add_menu_page( ...
7
votes
3answers
245 views

Getting a peer review for my new plugin?

What is the best way to get an experienced WordPress developer take a look at my plugin and give constructive criticisms? I have written code to solve some of my questions on this site, and I think ...
85
votes
37answers
10k 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 ...