July 14, 2012
Instructor: Nowell VanHoesen (@NowellVanHoesen)
By default, plugins are in wp-content/plugins/, but this can be changed
Be sure to have a unique name to avoid conflicts with other plugins
Plugins can function as single files in the plugin directory root
Would this approach (single file) prevent plugins from being part of the WordPress plugin repo? It wouldn't have a readme file...
- Coding
- Comment as much as possible. Besides just being smart coding, it'll help people who might modify your code
- Code indentation: use it
- Utilize what's there - don't create new tables or add functionality if it already exists within WordPress
- Only load JS, CSS, and external libraries when it's needed
- Provide feedback - tell people when it's not working
- Use security nonces to help protect the site from XSS
- Don't hardcode plugin URLs (which will break if plugins are installed in a non-standard location) - use
plugins_url()
instead (Codex)
Resources: