Let’s go into WordPress Core to understand if we can use get_post to sanitize fields when in display filter mode. You will reverse engineer Core to discover for yourself. You will use has_filter to see if there is a filter event that does the sanitizing for the data post_content. You’ll also learn about foreach.
Labs
Labs are hands-on coding projects that you build along with Tonya as she explains the code, concepts, and thought processes behind it. You can use the labs to further your code knowledge or to use right in your projects. Each lab ties into the Docx to ensure you have the information you need.
Each lab is designed to further your understanding and mastery of code. You learn more about how to think about its construction, quality, maintainability, programmatic and logical thought, and problem-solving. While you may be building a specific thing, Tonya presents the why of it to make it adaptable far beyond that specific implementation, thereby giving you the means to make it your own, in any context.
Sanitize with
Sanitize the Contents
Anything out of the database is not safe. It has to be sanitized before it is rendered out to the browser. Let’s talk about how to sanitize and which sanitizing function to use for the plugin. In this episode, you will see some nefarious code in action. Then you’ll try out two different sanitizing functions: esc_html wp_kses_post
Let’s Look in Core at get_post
– Part 2
This episode continues reverse engineering get_post in WordPress Core. Now that you understand the database, or at least have a basic understanding of it and SQL, you will continue looking at get_post. You’ll see how each column in the database populates a property in the object that you get back when calling this function.
Let’s Test It Out
How much stuff can I cram into one video? Well, a lot with this one. You’ll do some reorganizing the code and files to get clean, quality code from the start. I’ll show you how to setup the DocBlock templates in PhpStorm. And you’ll do some testing too. Let’s get started.
Introduction to Whoops
Let me introduce you to Whoops. You are going to love this error display. Not only is it nice to look at versus the out-of-box PHP orange error table, but it also gives you a lot of useful information. You can click on the code and view it right in the display. You get great details too. It will help you debug your code. Here’s a tip for you: you can configure up different editor themes. I like the sublime one. But you can choose from sublime, emacs, textmate, and macvim.
Introduction to Kint
In this video, you will play around with Kint and discover how it will help you to debug your code. Kint is a modern and powerful PHP debugging helper. It gives much more information than var_dump or print_r. Let’s check it out.
Setup Composer in Your Plugin
Let’s setup the local version of Composer. You will create and fill out the composer.json file as I explain it to you. Here is the starter composer.json file for you: Also, you can get this plugin on GitHub by clicking here.
What is a DocBlock?
What is a DocBlock? In this video, I’ll take you to phpDocumentor and discuss what a DocBlock is, as well as why you want to follow this PHP documenting standard. Then you’ll go to the WordPress PHP coding standard for contributing to core. The reasons why you want to learn how to properly document your code using PHP DocBlock are: Human readability – you and anyone else can read your code. You are able to read other people’s code. You know what it requires and what to expect from it when you call that function or method. Code – the […]
Plugin Header DocBlock
WordPress needs the file level PHP DocBlock filled out per its standard header format. In this video, you will enter in each required header metadata, line-by-line, and see what each does.
Plugin File and Folder Structure
Let’s start creating the file and directory structure for your new plugin. First we spin up a new site in DesktopServer. And then we create the folders and files. I’ll explain these to you as you build it with me.