Awesome
Awesome WordPress Developer Tips
Curated list that contain very awesome and ready code, snippets or examples without libraries or external packages made it for developers.
Why
This list is born from a real workflow in my development in WordPress, sometimes you don't need or not exist a library that do a specific stuff very well with a real case to study.
When i need something like that I search for other plugins that do that stuff to study and replicate, better if possible. For that reason I remember many plugins what they do and I search for recreate the same UX/UI. This list infact contain reference to plugins or docs but not to tutorials.
In this way is possible see in action, also the workaround used, and more important a case study.
In few words this is a list for skilled WordPress developers that want a simple way to found specific code (in the mainly case how use a specific hook).
PS: Part * is used because sometimes the code is splitted (maybe an hook declaration and a function).
PSS: Sometimes the code can be in the wrong line because the line is changed, search in the linked page or open a ticket to fix that list.
Table of Contents
Core
- Add backend/frontend fields in comments - Code from DaTask plugin: Part 1
- Add Screen Option in contextual tabs - Code from DaTask plugin: Part 1, Part 2
- Add links to Plugin in Plugin list - Code from DaTask plugin: Part 1, Part 2
- Add links to User in User list with action - Code from DaTask plugin: Part 1
- Add link in menu top bar - Code from WP Find Function plugin: Part 1, Part 2
- Add custom post type in search box - Code from WordPress Plugin Boilerplate Powered: Part 1, Part 2
- Add custom post type in Activity Dashboard widget - Code from WordPress Plugin Boilerplate Powered: Part 1, Part 2
- Add thumbnail in post type list in backend - Code from Ubik-Admin - Part1
- Detect the page in backend - Code from AdRotate Extra Settings plugin: Part 1
- Sort Taxonomy by taxonomy terms - By Scribu: Snippet
- Nonce for guest user - By Mte90: Snippet
- Transient example with external request - By Mte90: Snippet
- Show post thumbnails in RSS Feed - By Bobeta: Snippet
- Edit Dashboard Footer Admin Text - Code from DigitalDesigner: Snippet
- Edit Dashboard Howdy Text - Code from DigitalDesigner: Snippet
- Simple way to get a single post’s taxonomy - By dmpinder: Article
AJAX
- AJAX request for non-logged user
wp ajax nopriv_(action)
- AJAX request for logged user
wp ajax_(action)
- Use
wp_send_json()
,wp_send_json_success()
andwp_send_json_error()
for standard JSON request in AJAX request.
JSON REST API official
- Add meta field on v1 and v2 in readonly - Code from DaTask plugin: Part 1
- Extend WP Rest API v2 - Demo Plugin by Pete Nelson
External plugin
- Support for BadgeOS trigger - Code from DaTask plugin: Part 1
- Stop users from disabling critical plugins: Code Snippet by Derrick Tennant
Hacks
- Rename custom meta name - SQL Query by Tom Waters: Command
- Optimizing wp_options for Speed - Article by Pressjitsu: Article
- Life of a Front-end WordPress Request - Article by Roots: Article
- 10 WordPress Things I’ve learned working with 10up - Article by Rachie Vee: Article
- WordPress for the adventurous: WP_Query class - Article by Carl Alexander: Article
- Practical Guide to GDPR compliance for WordPress plugin & theme developers.
Tips
- Generate an HTML table from an array - By Mte90: Snippet
- Create a simple Sandbox Server for safe 'real-world' testing with DigitalOcean's One-Click Apps - Article by DigitalOcean : One Click Wordpress Install
- How WordPress Knows What Page You’re On - rmccue: Article
WooCommerce
- Updating multiple WooCommerce variant product shipping classes at once with SQL - By dmpinder: Article
- How to add GDPR support on your custom WooCommerce plugin
Other lists
- WordPress Plugin Boilerplate Powered - External useful resources
- Guide to build a better custom wordpress search including custom post types - Guide by WPMUDEV : Build your own search
License
To the extent possible under law, Daniele Scasciafratte has waived all copyright and related or neighboring rights to this work.