Playing nicely-with-other-plugins

Post on 15-Jan-2015

416 views 1 download

Tags:

description

 

Transcript of Playing nicely-with-other-plugins

playing nicely with other plugins

being a good citizen in the plugin development world

Pippin Williamson@pippinsplugins

http://pippinsplugins.com

some goals

we want to write plugins that work

even in environments “polluted” by other plugins

we want to avoid support tickets

“your plugin broke when I installed this other plugin”

we want to be nice to other developers

*or we should want to be nice*

we want to be liked by other developersno one likes it when other developers break their

plugins

let’s try to avoid being the ones responsible

we want to create a cohesive

environmentplugins running nicely with other plugins is

awesome

we want to be good citizens

don’t be that person“ain’t my problem!”

it is always our problem

a problem for the users is a problem for the developer

we help others by helping ourselveseliminating a conflict with plugin Y prevents

X support tickets for both parties

tips

never assume a clean environmenttest on sites with dozens or hundreds of plugins

installed

use classes and IDs in your CSSform input { display: none; }

that’s just not nice

be careful when filtering content

the the_content filter is awesome

and oh so dangerous

check if libraries are loaded

loading Stripe’s API twice isn’t pretty

don’t take over all the queries!

pre_get_posts is the key master

it can break everything

don’t arbitrarily change actions or

filtersbackwards compatibility matters

don’t break your extensions and/or themes

be careful with form submissions

always use input names or nonces to detect your own form submissions

notices can break ajax requests

be a good citizen and use isset() and empty()

for the love of all that is holynever load your own jQuery

or other scripts included in WP core

pippinsplugins.com/why-loading

conditionally load JS

conditionally load CSS

be careful with post type names

“book” may not be the best option, but “product” might

be careful with option names and

meta_keyshaving settings conflict between two plugins is no

fun

be careful with list table column namesnaming a column “user” can easily be overwritten

in another plugin with one called “user”

- -————

encourage others to be good citizensreward developers for finding conflicts

be courteous when developers report conflicts

encourage others to be good citizens

do not always assume YOU are right

every developer screws up

encourage others to be good citizens

take the high road and be willing to help resolve issues

even if they aren’t in your code

be nicefind a conflict, report it appropriately

never black list a plugin immediately

be nicefind a security flaw, report it confidentially

don’t yell and scream how plugin X is insecure

treat others how you wish to be

treatedit was true before code and it is still true with code

ask me anythingseriously, anything