SlideShare a Scribd company logo
1 of 17
LET’S WRITE A PLUGIN
STUPID WORDPRESS TRICKS PART 0.1A
BRIAN LAYMAN
HTTP://EHERMITSINC.COM
HTTP://SLIDESHARE.NET/BRIANLAYMAN
• Brian Layman
• I work from home
• I spend all day on the computer
• All best my friends are online
• I don’t hang out at parties
• I spend my day in a cave like room
• Yes, I am an eHermit
http://eHermitsInc.com
INTRODUCTION
MY WORLD
http://imgs.xkcd.com/comics/tech_support_cheat_sheet.png
Our
Dark
Secret
BEFORE WE START TO PLAY
• What is a plugin?
• What can plugins do?
• What do you need to know?
• “But I heard plugins make your site slow!”
• “But I heard that plugins make your site insecure!”
PLUGIN SURVIVAL KIT
• http://wordpress.org/plugins/ - Look for a plugin that is similar
• http://wordpress.org/plugins/about/ - Describes how to create a plugin
• http://codex.wordpress.org/ - Your guide
• http://codex.wordpress.org/Writing_a_Plugin
• http://codex.wordpress.org/Plugin_API/Action_Reference - When actions are called
• http://codex.wordpress.org/Plugin_API/Filter_Reference - List of common Filters
• http://themergency.com/generators/wordpress-plugin-boilerplate/ - Basics
• http://generatewp.com/ - Helps add Features
PLUGIN
• A Plugin is a group of php functions that can extend the functionality present in a standard
WordPress weblog. These functions may all be defined in one php file, or may be spread
among more than one file. Usually, a plugin is a php file that can be uploaded to the "wp-
content/plugins" directory on your webserver, where you have installed WordPress. Once you
have uploaded the plugin file, you should be able to "turn it on" or Enable it from the "Plugins"
page in the administration interface of your weblog. The WordPress source code contains
hooks that can be used by plugins.
• See also: Hack, Hacking
• Related articles: Plugins
http://codex.wordpress.org/Glossary
HOOK
• Hooks are specified, by the developer, in Actions and Filters. Here is a (hopefully) complete
list of all existing Hooks within WordPress.
Because Hooks are required by Actions and Filter you may hear the phrase "Action Hooks" and
"Filter Hooks" used from time to time.
In technical and strict terms: a Hook is an event, i.e. event as understood by Observer pattern,
invoked by the do_action() orapply_filters() call that afterwards triggers all
the action or filter functions, previously hooked to that event usingadd_action() or add_filter(),
respectively.
•See also: Action, Filter
•Related articles: Hooks, Actions and Filters, Plugin API/Hooks
http://codex.wordpress.org/Glossary
FILTER
In WordPress, a Filter is a function that is associated with an existing Action by
specifying any existing Hook.
Developers can create custom Filters using the Filter API to replace code from
an existing Action. This process is called "hooking".
Custom Filters differ from custom Actions because custom Actions allow you
to add or remove code from existing Actions. Whereas custom Filters allow you
to replace specific data (such as a variable) found within an existing Action.
•See also: Action, Hook, Terminology Confusion
•Related articles: Filters, Filter Reference, add_filter()
http://codex.wordpress.org/Glossary
ACTION
• In WordPress; an Action is a PHP function that is executed at specific points throughout the
WordPress Core.
Developers can create a custom Action using the Action API to add or remove code from an
existing Action by specifying any existing Hook. This process is called "hooking".
For example: A developer may want to add code to the footer of a Theme. This could be
accomplished by writing new function, then Hooking it to the wp_footer Action.
Custom Actions differ from custom Filters because custom Actions allow you to add or
remove code from existing Actions. Whereas custom Filters allow you to replace specific data
(such as a variable) found within an existing Action.
•See also: Filter, Hook, Terminology Confusion
•Related articles: Actions, Action Reference, add_action()
•Forum posts: Filters vs. Actions Discussion and Explanation
http://codex.wordpress.org/Glossary
OK – HOW ARE WE DOING?
HELLO DOLLY
LET’S PLAY
• We’re going to use the tools we have seen to create a plugin
• Let’s mess with Dolly’s head a little bit
• Using actions
• Using filters
• Including CSS
• Including Scripts
BRIAN DID MIRACULOUS STUFF YOU CAN’T SEE IN
THE DOWNLOADED SLIDESHOW
• Bet you wish you were at Ohio’s 2014 North Canton WordCamp
• Then you could have seen us do all the fun stuff we did
• We’re sorry you missed it
• Maybe you can make it next year..
• OK next slide…
FIGURING OUT WHERE YOU MESSED UP
• http://codex.wordpress.org/Editing_wp-config.php
@ini_set( 'log_errors', On' );
@ini_set( 'error_log', '/home/example/php_error.log' );
@ini_set( 'display_errors', 'On' );
@ini_set( 'error_reporting', E_ALL );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', true );
DOING THINGS RIGHT
• Data Validation
• https://codex.wordpress.org/Data_Validation
• esc_attr, wp kses, esc_url
• Use $wpdb for database access
• get_var, get_row, insert, update, delete
• Use prepare for custom queries
• $wpdb->query( $wpdb->prepare(“select blah from foo where i= %d”, $myintvar )
BRIAN LAYMAN
http://eHermitsinc.com
http://thecodecave.com
http://www.slideshare.net/brianlayman
http://twitter.com/brianlayman
@eHermits
My info->your phone, Txt “ehermit” to 50500
Brian@eHermitsInc.com

More Related Content

What's hot

WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
Joe Casabona
 
WordPress Security - WordPress Meetup Copenhagen 2013
WordPress Security - WordPress Meetup Copenhagen 2013WordPress Security - WordPress Meetup Copenhagen 2013
WordPress Security - WordPress Meetup Copenhagen 2013
Thor Kristiansen
 

What's hot (20)

WordPress Security Basics - Melbourne WordPress User Meetup
WordPress Security Basics - Melbourne WordPress User MeetupWordPress Security Basics - Melbourne WordPress User Meetup
WordPress Security Basics - Melbourne WordPress User Meetup
 
Emergency WordPress Troubleshooting
Emergency WordPress TroubleshootingEmergency WordPress Troubleshooting
Emergency WordPress Troubleshooting
 
WordPress Security
WordPress SecurityWordPress Security
WordPress Security
 
How to create a WordPress Site
How to create a WordPress Site How to create a WordPress Site
How to create a WordPress Site
 
WordPress Security Essentials
WordPress Security EssentialsWordPress Security Essentials
WordPress Security Essentials
 
WordPress Fav Plugins & Security
WordPress Fav Plugins & SecurityWordPress Fav Plugins & Security
WordPress Fav Plugins & Security
 
WordCamp Boston WordPress plugins-8-2014
WordCamp Boston WordPress plugins-8-2014WordCamp Boston WordPress plugins-8-2014
WordCamp Boston WordPress plugins-8-2014
 
WordPress Intermediate Workshop
WordPress Intermediate WorkshopWordPress Intermediate Workshop
WordPress Intermediate Workshop
 
WordPress Security
WordPress SecurityWordPress Security
WordPress Security
 
NEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & SecurityNEPA BlogCon 2013 - WordPress Customization & Security
NEPA BlogCon 2013 - WordPress Customization & Security
 
Wordpress introduction
Wordpress introductionWordpress introduction
Wordpress introduction
 
8 Ways to Hack a WordPress website
8 Ways to Hack a WordPress website8 Ways to Hack a WordPress website
8 Ways to Hack a WordPress website
 
Coding with jetpack
Coding with jetpackCoding with jetpack
Coding with jetpack
 
WordPress Customization and Security
WordPress Customization and SecurityWordPress Customization and Security
WordPress Customization and Security
 
Installing and Setting Up WordPress
Installing and Setting Up WordPressInstalling and Setting Up WordPress
Installing and Setting Up WordPress
 
WordPress Security - WordPress Meetup Copenhagen 2013
WordPress Security - WordPress Meetup Copenhagen 2013WordPress Security - WordPress Meetup Copenhagen 2013
WordPress Security - WordPress Meetup Copenhagen 2013
 
Using Wordpress for Internet Publishing--TechConnections version
Using Wordpress for Internet Publishing--TechConnections versionUsing Wordpress for Internet Publishing--TechConnections version
Using Wordpress for Internet Publishing--TechConnections version
 
Building Secure WordPress Sites
Building Secure WordPress Sites Building Secure WordPress Sites
Building Secure WordPress Sites
 
WordPress Security and Best Practices
WordPress Security and Best PracticesWordPress Security and Best Practices
WordPress Security and Best Practices
 
Introduction to Wordpress (Research Based)
Introduction to Wordpress (Research Based)Introduction to Wordpress (Research Based)
Introduction to Wordpress (Research Based)
 

Similar to Let’s write a plugin

Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
Rich Bradshaw
 
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Thinkful
 
JavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefoxJavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefox
Gennady Feldman
 
Bending word press to your will
Bending word press to your willBending word press to your will
Bending word press to your will
Tom Jenkins
 

Similar to Let’s write a plugin (20)

2016 WordCamp Pittsburgh - Let's Write a Plugin
2016 WordCamp Pittsburgh - Let's Write a Plugin2016 WordCamp Pittsburgh - Let's Write a Plugin
2016 WordCamp Pittsburgh - Let's Write a Plugin
 
WordPress Hooks (Actions & Filters)
WordPress Hooks (Actions & Filters)WordPress Hooks (Actions & Filters)
WordPress Hooks (Actions & Filters)
 
Intro to WordPress Plugins
Intro to WordPress PluginsIntro to WordPress Plugins
Intro to WordPress Plugins
 
How to create your own WordPress plugin
How to create your own WordPress pluginHow to create your own WordPress plugin
How to create your own WordPress plugin
 
From WordPress With Love
From WordPress With LoveFrom WordPress With Love
From WordPress With Love
 
Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016Introduction to WordPress Hooks 2016
Introduction to WordPress Hooks 2016
 
Decoding Core Contribution - WordCamp San Diego 2013
Decoding Core Contribution - WordCamp San Diego 2013Decoding Core Contribution - WordCamp San Diego 2013
Decoding Core Contribution - WordCamp San Diego 2013
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
Getting Started with WordPress Plugin Development
Getting Started with WordPress Plugin DevelopmentGetting Started with WordPress Plugin Development
Getting Started with WordPress Plugin Development
 
Introduction to Wordpress Hooks
Introduction to Wordpress HooksIntroduction to Wordpress Hooks
Introduction to Wordpress Hooks
 
WordPress Complete Tutorial
WordPress Complete TutorialWordPress Complete Tutorial
WordPress Complete Tutorial
 
The Web Application Hackers Toolchain
The Web Application Hackers ToolchainThe Web Application Hackers Toolchain
The Web Application Hackers Toolchain
 
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
Build a Web App with JavaScript and jQuery (5:18:17, Los Angeles)
 
Your Site Has Been Hacked, Now What?
Your Site Has Been Hacked, Now What?Your Site Has Been Hacked, Now What?
Your Site Has Been Hacked, Now What?
 
Hacking 101
Hacking 101Hacking 101
Hacking 101
 
JavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefoxJavaScript debugging diagnostic web tools and firefox
JavaScript debugging diagnostic web tools and firefox
 
php[world] Hooks, Actions and Filters Oh My!
php[world] Hooks, Actions and Filters Oh My!php[world] Hooks, Actions and Filters Oh My!
php[world] Hooks, Actions and Filters Oh My!
 
Bending word press to your will
Bending word press to your willBending word press to your will
Bending word press to your will
 
Modern websites in 2020 and Joomla
Modern websites in 2020 and JoomlaModern websites in 2020 and Joomla
Modern websites in 2020 and Joomla
 
WordPress plugin development
WordPress plugin developmentWordPress plugin development
WordPress plugin development
 

More from Brian Layman

More from Brian Layman (8)

WordPress Rest API
WordPress Rest APIWordPress Rest API
WordPress Rest API
 
Drupal & Joomla & WordPress.. Oh My! A quick round-up of the three most popul...
Drupal & Joomla & WordPress.. Oh My! A quick round-up of the three most popul...Drupal & Joomla & WordPress.. Oh My! A quick round-up of the three most popul...
Drupal & Joomla & WordPress.. Oh My! A quick round-up of the three most popul...
 
Unfailing Love
Unfailing LoveUnfailing Love
Unfailing Love
 
Word Camp North Canton 2013 - Say what? Say that again in plain English...
Word Camp North Canton 2013 - Say what? Say that again in plain English...Word Camp North Canton 2013 - Say what? Say that again in plain English...
Word Camp North Canton 2013 - Say what? Say that again in plain English...
 
WordPress 3.5
WordPress 3.5WordPress 3.5
WordPress 3.5
 
Why WordPress?
Why WordPress?Why WordPress?
Why WordPress?
 
WordPress 3.8 Beta 1
WordPress 3.8 Beta 1WordPress 3.8 Beta 1
WordPress 3.8 Beta 1
 
Brethren - What Does It Mean?
Brethren - What Does It Mean?Brethren - What Does It Mean?
Brethren - What Does It Mean?
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Let’s write a plugin

  • 1. LET’S WRITE A PLUGIN STUPID WORDPRESS TRICKS PART 0.1A BRIAN LAYMAN HTTP://EHERMITSINC.COM HTTP://SLIDESHARE.NET/BRIANLAYMAN
  • 2. • Brian Layman • I work from home • I spend all day on the computer • All best my friends are online • I don’t hang out at parties • I spend my day in a cave like room • Yes, I am an eHermit http://eHermitsInc.com INTRODUCTION
  • 5. BEFORE WE START TO PLAY • What is a plugin? • What can plugins do? • What do you need to know? • “But I heard plugins make your site slow!” • “But I heard that plugins make your site insecure!”
  • 6. PLUGIN SURVIVAL KIT • http://wordpress.org/plugins/ - Look for a plugin that is similar • http://wordpress.org/plugins/about/ - Describes how to create a plugin • http://codex.wordpress.org/ - Your guide • http://codex.wordpress.org/Writing_a_Plugin • http://codex.wordpress.org/Plugin_API/Action_Reference - When actions are called • http://codex.wordpress.org/Plugin_API/Filter_Reference - List of common Filters • http://themergency.com/generators/wordpress-plugin-boilerplate/ - Basics • http://generatewp.com/ - Helps add Features
  • 7. PLUGIN • A Plugin is a group of php functions that can extend the functionality present in a standard WordPress weblog. These functions may all be defined in one php file, or may be spread among more than one file. Usually, a plugin is a php file that can be uploaded to the "wp- content/plugins" directory on your webserver, where you have installed WordPress. Once you have uploaded the plugin file, you should be able to "turn it on" or Enable it from the "Plugins" page in the administration interface of your weblog. The WordPress source code contains hooks that can be used by plugins. • See also: Hack, Hacking • Related articles: Plugins http://codex.wordpress.org/Glossary
  • 8. HOOK • Hooks are specified, by the developer, in Actions and Filters. Here is a (hopefully) complete list of all existing Hooks within WordPress. Because Hooks are required by Actions and Filter you may hear the phrase "Action Hooks" and "Filter Hooks" used from time to time. In technical and strict terms: a Hook is an event, i.e. event as understood by Observer pattern, invoked by the do_action() orapply_filters() call that afterwards triggers all the action or filter functions, previously hooked to that event usingadd_action() or add_filter(), respectively. •See also: Action, Filter •Related articles: Hooks, Actions and Filters, Plugin API/Hooks http://codex.wordpress.org/Glossary
  • 9. FILTER In WordPress, a Filter is a function that is associated with an existing Action by specifying any existing Hook. Developers can create custom Filters using the Filter API to replace code from an existing Action. This process is called "hooking". Custom Filters differ from custom Actions because custom Actions allow you to add or remove code from existing Actions. Whereas custom Filters allow you to replace specific data (such as a variable) found within an existing Action. •See also: Action, Hook, Terminology Confusion •Related articles: Filters, Filter Reference, add_filter() http://codex.wordpress.org/Glossary
  • 10. ACTION • In WordPress; an Action is a PHP function that is executed at specific points throughout the WordPress Core. Developers can create a custom Action using the Action API to add or remove code from an existing Action by specifying any existing Hook. This process is called "hooking". For example: A developer may want to add code to the footer of a Theme. This could be accomplished by writing new function, then Hooking it to the wp_footer Action. Custom Actions differ from custom Filters because custom Actions allow you to add or remove code from existing Actions. Whereas custom Filters allow you to replace specific data (such as a variable) found within an existing Action. •See also: Filter, Hook, Terminology Confusion •Related articles: Actions, Action Reference, add_action() •Forum posts: Filters vs. Actions Discussion and Explanation http://codex.wordpress.org/Glossary
  • 11. OK – HOW ARE WE DOING?
  • 13. LET’S PLAY • We’re going to use the tools we have seen to create a plugin • Let’s mess with Dolly’s head a little bit • Using actions • Using filters • Including CSS • Including Scripts
  • 14. BRIAN DID MIRACULOUS STUFF YOU CAN’T SEE IN THE DOWNLOADED SLIDESHOW • Bet you wish you were at Ohio’s 2014 North Canton WordCamp • Then you could have seen us do all the fun stuff we did • We’re sorry you missed it • Maybe you can make it next year.. • OK next slide…
  • 15. FIGURING OUT WHERE YOU MESSED UP • http://codex.wordpress.org/Editing_wp-config.php @ini_set( 'log_errors', On' ); @ini_set( 'error_log', '/home/example/php_error.log' ); @ini_set( 'display_errors', 'On' ); @ini_set( 'error_reporting', E_ALL ); define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', false ); define( 'WP_DEBUG_DISPLAY', true );
  • 16. DOING THINGS RIGHT • Data Validation • https://codex.wordpress.org/Data_Validation • esc_attr, wp kses, esc_url • Use $wpdb for database access • get_var, get_row, insert, update, delete • Use prepare for custom queries • $wpdb->query( $wpdb->prepare(“select blah from foo where i= %d”, $myintvar )