 So, yes, as Carl says today, people are often very confused about hooks and filters, so I'm going to try and make a quick sentence. First thing that hooks and filters are absolutely everywhere throughout the WordPress source code. This is just even a core, and plug-ins also have their own. If we didn't have them, WordPress, you couldn't do anything with it. It's a developer's gateway into WordPress to make all these changes, you know, enhance it. If we didn't have it, we probably wouldn't have any plug-ins that we do have, you know, massive amounts of plug-ins to do. So if you're, as I said also, you know, if I'm looking at the source code, I go searching for things that do actually apply to filters. And when I see those, you know, those code calls there, I know that's an opportunity for me to interact with that plug-in or with WordPress at that point of time. And so, you know, like, WooCommerce is a fantastic example of tons of these around the place, so you don't have to go hacking those ones. And so the WordPress core has allowed them as well, so you don't have to hack it. I did a search for WordPress 4.95, and I found 860.72 action calls, and 1,700.385 filters calls. That's a huge number. It's this thing on the right-hand side, you might have a bit of a hard to see. One of the actions that it might come across is don't have any head. You'll see it in your, you'll probably see it a lot of times on themes. And so WordPress itself adds a lot of, uses that particular action to add a lot of code in there. And so, I mean, I don't know, I think it was about 20 in the WP head. I'll give you examples of what it's doing in those cases. And so the first thing to do is, what's the difference between actions and filters? Hux is a bad name, I think, really. It, you know, doesn't really apply, but it might be, you might continue to, you can hook your way into the source code or into the execution of WordPress and do something. But with the actions and filters, which are the two different types that are available in the code, actions allow you to, it's, when you see do action, that's, you know, an action point. And the WordPress is going to see who's going to be, who wants to run at that point in time. What it's doing is, you can run your code at that point in time. You don't return any data, and that's the difference between any filters, but you get to run your code. When you see applied filters, it's what it's going to do with anyone who wants to run to the code at that point and give them some data, you know, which is obviously developed at that point. And, you know, you can do your code, and you're expected to return some data with it. So, to give a metaphor, again, to try and help on the standards, I would describe, you know, actions like a music festival. So, for example, the BBC's biggest, biggest weekend is on the moment over near the time quarter. And today, remember back, so let's say you decide you want to see Nina Cherry this afternoon. What, when this, with the music festival here, you say to somebody, hey, look, I want to see Nina Cherry. Give me a call, she's coming on stage. And, you know, when you get that call, you say, if I ever get my Nina Cherry, if you're not, I better get my little, you know, old CD, a little I-Sushi way back there, and, you know, get it all right, show them a real fan, and, you know, remember all those words and stuff like that. They might just die from compression going. And so it says, you know, in your code, you're going to write something like that action. This is the action name, so when you see a do-action caller, you're on, it has a, that's it there. Then this is the name, your code, and this is the position. And, like you thought, this is coming number 10, but if you decide it, it's to do a cuing. So when the WordPress comes along, WordPress goes along, and at this point in time, it says do-action bad name, it has a quick look, hey, who wants to be called, and who wants to be called a modeler. You might decide, I want to be called first, second, third. And that becomes more relevant depending on what you're trying to do. But most of the time, people don't write in there, 10 is fine, you know, they pick 10, so you can do lower numbers. And I mean, you have that number you want, you have 10,000, there's no over, there's no over number. Two. So, that's kind of obvious, yeah. Sorry about that. Okay, so with core, with do-actions, in WordPress, when I said I saw there was a ton, there was an 800 instead of, yes, 800. With your look at what happened, and there's a lot of, there's a lot of ones that use, when the page has been executed, you know, you make requests all the way to the end of the page being delivered, the core calls a number of plugins or actions that, you know, people are typically going to use. You'll see things like plugins loaded, which indicates all the plugins are all loaded, you know, they have something to do with something. And after the theme has now been loaded, and ending in it, one time showed that yesterday when he was registering, or earlier on, when he was showing the register of taxonomies, you do that, he also showed pre-guest posts, you know, where you can decide to modify the filter, and the one I showed earlier, your WP head. So, but there's a ton of, there's a particular codec reference, and this is about facing them. And it gives you an idea, if you're doing something with, you know, anything with your WordPress, with your page, where you want to execute, for example, you can have something that executes right at the very end where you want to do some tidying up. But it lists them all there, and there are obviously, you know, 810 more. The plugins, and with regards to that one, they're all done in certain times, okay? And they become quite important, especially for the plugin loading. I think it's a good example of that. If, for example, plugins, there's a database entry, which has active plugins, and it lists them all alphabetically. And WordPress comes out and just runs those, those all in that order. Now, if your WooCommerce thing, right down the end of the alphabet, if I have plugins called amazing, you know, advanced WooCommerce, it's going to get run before WooCommerce. So if I wanted to do something with WooCommerce, I can't start running WooCommerce functions until that's loaded. So what I have to do with my code is, I'll say, oh, actually, my code I really want to run, run it on the plugins loaded action, so that won't actually get run. So that's like saying, hey, tell me when everything's loaded and come back to me and I'll run my code. So when everything gets loaded, now WooCommerce is loaded, now I can come back, you know, I'm called, and say, hey, do your stuff now. So I'm not running stuff early, having scenarios where, well, hey, this function doesn't exist. You know, you're actually sort of saying, you know, just put me down for this, come back later, and I'll do it. And when you're doing all your code, when you have your plugin, if you want to run something and, you know, your plugin's actually loaded really early on, but you don't get your code called later on, that's the whole thing about actions, and more just putting in like that music act to say, you know, I'm putting my register, registering my interest very early on, but, you know, I'm not going to get called to the appropriate right time. And so, here's a super simple example of what it would look like, and I say, in the code, you're in, so you write that action. This is the action name you'll see, it's my function name, I just put it in there, for example. And this is what it looks like, I have my function. So, because it's an action, I said it's, you actually get to do something, you're not actually returning any data, you're putting something there, and look, I'm just going to enter a comment. So, if I use the code, I've often said to people, and if you want to, you know, there's like, oh, my action, my code's not working. It's like, well, just put something in there that's going to render in your HTML, you know, and as a comment, it's not going to damage at least if you could view source and go, that is wrong, you know, then you can start working on what the rest is not working. And as I said, you know, this third one is default, so I didn't need to add it, just to show you where I made, but it's any positive number, it can be. And the example I wrote on was WP head, and you saw it, that small screen shot, it was from one of the core source files that there was a ton of code that's added to it. So, within WordPress core, really, this is the line that calls all those guys. And so, what WordPress does, it goes, oh, hey, all those guys who want to run this particular point is not necessarily running them. So, this function here, which is in this 20 trailer, and said, and on that action, WP head called this function, and that function actually pretty much just does this particular markup. So, when you look, the scene, if you look, you want to view source and say, what version of WordPress are you working on there? That's where that line came from, from that function. And that's why you'll often see these security plugins or optimization plugins where they remove that, trying to anonymize it, so hopefully, you know, no zero-blade function, zero-blade vulnerabilities are being exposed, and all they're doing is actually just stopping them running. So, an example, let me do an example here, where there's multiple uses for do action. And one example I would give is, you know, adding content. Like WP generator, you add a particular bit of content into the markup. If I could do something similar, I want to add my own name into the markup to show why I wrote this particular page. And so, what I just do is I do an add action and add my own name, and this is my code here, and all it does is, you know, spit out some mark, and so obviously, I haven't dropped out a PhD and got back in again, and that's why I didn't have to do an echo call. So, that's a simple example there. So, another one you can also do is, you know, when you do an add action, you can also do what the orders are running. You can come to that and actually say, oh, by the way, I want to remove something else. I'll show you how that would work. So, I said that there's three plugins that they might decide, hey, we don't want to expose the WordPress version. So, what they will do is, you know, use, sort of, say this was being added by this. So, what I do, and this is where the part comes into it, because obviously, if I wrote my client code before this, I might say, hey, remove this particular thing, it wasn't added to the list, you know, the music that interests this, so I can't add it. So, what I have to do is, I'm coming across here, or WP head, you know, I'm going to jump in and remove, just before, just jump ahead in the queue before this other one is about to be run, and I'll just remove it. So, that's where those security plugins probably do something similar to that, like they might use it slightly in action, but they have to run it. They have to run, if they made that number 11, if that function is already run, it's too late, you know, you're gone. So, you have to don't jump in before I can take it out. And you can do that, anything that has been added by add action, you can pretty much jump ahead of it and remove, you know. So, you can disable stuff with, you know, WooCommerce without, you know, adds a lot of stuff with add action. Again, you can use this type of scenario, jumping in before they get run, do something, take them out, change their order. Another scenario in this, WooCommerce, if you want to move stuff around. So, WooCommerce, I don't know what person was, they changed their templates. So, instead of actually having everything in big templates that were quite inflexible and required due to the edit template files, they changed to be in add actions. So, what they would have is like a single do action call, and early on they would have said add action, they'd say add the price, add the image, add the meta, add the short description, add the long description, and the variable fee is all those things added by that. And so, what that allows you to do is change things around or remove things. If you decided you wanted to hide the title or you wanted to hide the price until people are, you know, logged into your site, and that's what they would do is they would hide it. They wouldn't have to edit it and template it fast. So, for the example here is, I decided here, I want to move things around. Okay, so, what I do is I jump in, just before I jump in, this particular action is called before all this stuff here. So, what I do is I jump in pretty early and then start moving stuff around. And what I'm doing here, this one here, when you do a remove action, you have to call it. You have to call exactly the same add action, you know, but you just change remove to add. So, in WooCommerce code, source code, it'll have add action, all that, and, you know, template single price with a problem of 10. So, what I like to do is I have to go over the chain that you remove and I'm going to add in certain different spots. So, what I'm actually doing is, instead of appearing in, you know, the 10th position, I'm running it harder. So, the price will probably be very, very high upon the page. I do have an example of my own website where I just, a very exaggerated example where I just turned the whole WooCommerce page upside down by doing this type of thing. By removing them all and then adding them all in a completely different order. Just to show that you don't need to modify template files because that becomes a nightmare when WooCommerce updates theirs. Now, the filters, I think, I've often had a bit more difficulty with filters, partially because of the actual syntax involves a bit longer. So, what I would compare it to, like past the parcel, I don't know if everyone's familiar with that idea. It's a party game where somebody has a parcel and has a gift wrapped inside it, multiple layers of wrapping paper, and as it goes along with the music stuff, the child takes a piece of wrapping paper off it. So essentially when all the piece of paper is removed and it goes around in circles, they win that prize. So that type of idea is where they're being passed when you're with the added filters, your function is given some data called out the parcel, and the WordPress expects that parcel to come back. Now, the parcel can be unchanged, it can be changed. You can add more wrapping paper, you can remove wrapping paper, you can switch it to a completely different parcel in there, but you do have to return something back. So essentially, when we have the added action call, the added action call ended there, whereas with filters, you might be passing it at a number of pieces of data to you, so you have this as the counting for that. So, I'll give you an example of the content. So when you call the function of the content, and it has the same name as the filter, they are very different, so to say, when you call the content, it goes and calls the content filter. So that allows people, that allows WordPress, for example, to change all the, your smart aids can get changed, you can actually, I don't think it doesn't fit. There's a number of different things it does, and it might put in paragraph tags and that type of thing, and short calls are getting done as well. So, if you wanted to make some stuff, for example, if I wanted to append something to the end of all my posts, you know, not just footers, I would do something on filter. And it looks very like the add-action call, and, so, this is the actual name of the thing, this is the my function, because there's only one, and because I'm both positioned 10, you know, in order, and there's only one parameter, they can default, it's 10 and 1, so I don't have to add them, but I'm receiving this bit of data, and so what I'm all on doing is just taking the, and returning that bit of data, and this at the end. This is a very, very simple way to do stuff, and, you know, that's a very simple example. They do sometimes gash, a little bit more complicated, this is where the 10 and 2 come in, so in WooCommerce, for example, when they, they have a thing that says, the product is in stock, and you can decide to change it, you can remove it, or even when you decide you want to, you know, if it's on sale, it's show-numbing, you know, you might want to put that back for it and so forth. So with the add filter, you just say, add filter, now here's my particular function, main, and I'm going to, when you have a 2 here, you have to add a 10, and so on, because I can say it's 2, I can just pass to it. So what WooCommerce is passing to you is, it's passing in the string, it would say, in stock, and it's passing in the product object. So when I have this product object, now I can, this is, I can check the products, it's on sale, return nothing, otherwise return it, and yeah, so that's, you know, a simple way of changing stuff, I didn't have to file a template file, and maybe, I don't know those extra conditions here, I can change it to be saying, hey, it's super on sale by now, priority, or, you know, it's not on sale, just stick with it, you know, so you can choose it, change it, and another one I often do, about a particular filter, because he often says, well, I wonder if this is the right filter I've chosen for this particular bug face, and you might know what I often do is, you know, I check the data that's coming to me, so, for example, here, what I'm doing, and this goes back to the talk this morning about debugging, and so I say, well, am I adding a filter here, this filter actually doesn't modify any data, it returns the data, but I made a point of actually looking at what data came into it, I'm writing it to the error log, hopefully it's my debug log and WD constant area, and I'm also noting the page, so therefore, what I can do is, I can run my page, nothing has changed, I can go to the error log and say, hey, what data was passed and what page it was, and I can learn something better, and if this is a very simple one that was passed, with the WooCommerce one, I maybe didn't know, I don't know what spring came in, I don't know what's there, I can do a VAR export of products, and what data is coming into me, and I see, well, is this going to be useful, or do I need to use that data to find something else? So the big question is, where does all this code come from? So if you were to write a small little bit of code, I'd say, where do you put it? And you might not want to put it if you're a theme, you may only have a parent's theme and you say, well, I can't be modified, that's not a great idea at all, and you say, well, I think it's actually much easier, if you have a child theme, you can throw it into its functions.php file, but you may have code that you might say, I'm going to be changing this theme the next while, but this particular bit of code, I don't want to disappear, no matter what theme I'm going to use, I'm going to have this particular feature, something we would call a functional plugin. Previous talk, Tom said you can go to generatewp.com and it's a very simple one, I decided I'd call it that, I gave it to you in a quick description, because certainly these two bits of text will appear under plugins, so you know when a plugin is there, and I think it's also very useful that when it's a plugin, you can activate it, deactivate it, especially with something you only have for temporary use, but for a very short term, it's quite healing. So, I need to snippet that code I had already gone, you can just add a redoubt. It also means that you can say you deactivate it, you can invite it, or if there was a problem with it, like if it bombed out, if you put some code in here, let's say you have a spelling mistake in it, or a typo in it, when you try to activate it, WordPress is going to trap that thing, or if you put it into your functions on PHP, you had a mistake in it there, you load up the page, you've got your white screen, whereas this one you've caught it, you haven't affected anyone at all, you just go back and fix it, and then you can activate it and help you save it. So, the summary is that I'd say my metaphor is for actions, like you're getting a line for concerts, you're just doing stuff, you just line up and you do your thing and you have to move, in the parcel where you're actually dealing with data, you have to return the data, which you've quantified as well, and a function on coding updates are very safe, with an Azure code that won't damage anything, won't get lost in updates, won't get lost in team changes either, so that's it. I really like the analogies, they're reading very well. They're running or something. My only issue with path to parcel is, as a Rusty PHP developer, for filters for me, I just can't get the paper off. So, is there any, filters, just to me, sometimes are quite difficult to just parse in terms of understanding what an applied filter in its intention is doing, are there any kind of tricks or ways of deciphering how to use a filter that you kind of come across? Because the example you get was great. Some filters get incredibly complex in terms of how they operate. Some of them are rigged. I had struggled for a while when you see an ad filter call, especially when it's embedded in a line of older stuff, especially because one of those, what's the triple one where you have a question mark call, one of those ones, one thing I always try to remember, and it's very quickly easy to get, is when it says that apply filters, the next parameter is the data that's coming and they want to come back to you. So you can have, for example, instead of applying filters, this video, I said HTML and then product. And that's where you think I've often looked at which is how we come back, especially where it was multiple parameters. And that's exactly why you're buying me this debugging thing, because I always experiment with stuff that way. And when it comes in, I always do a VAR export, or an air log of VAR export all the day to see what it was. And then, so now I understand what's going through that filter and then I go back into it. But this is a very safe way, always returning what I think should be, you know, you're not crashing stuff. You're not going to get just 500 errors and so forth. But, yes, it is, especially when they're written, if they're written on a single line, I've gone, you know, data equals apply filters, something, data. So they're passing data and sending it right back again. They're easy enough to understand. But when it's embedded in a line, that's why I always go for this. As a VAR export, VAR export is the one that's the truest way to get it. Yeah, because if you do a VAR export, whatever's true, it gets on your page. So, as an air log of VAR export, I always use that. It will send my data to it, it won't send it to a browser, it'll send it to an air log, and I can go look and go, oh, yeah, I can nail it. And especially if it's an object, or it's an array, and now you can understand how it would have died, it would have never died in, but it is a challenge, yes. Good. Thank you. Yeah, it's very easy to note the big sequential list of filters and actions, and it kind of feeds a little bit sloppy. I was going to wonder, is there any performance issue with a lot of us to a position of plug-in or to functions? And also, so it actually functions, I think it's a mid, people are often concerned about adding an extra plug-in. As always, they don't add too many plug-ins. But with regard to WordPress, I mean, if it's in your functions on PHP or it's in a plug-in, it's just another bit of code. They just have different names, you know, you might say, oh, it's in my theme, it's in my functions on PHP in my theme, and that's a huge look, and it's going to be difficult to manage. But you know, these things are all extremely quickly, the same code has been executed, you know, depending where you put it. But so the non-performance, in fact, I don't think there's any performance benefit in your theme or in a plug-in. I actually think it's easier to manage if it's in a plug-in because if you want to disable it, you can disable it just that one bit. It's just got a few years wrong. No, I agree with you. I think it is a misconception in it. And so it's justified to not having too many plug-ins. But I think a lot of people are perfectly wrong with two extremes. There are plug-in plug-ins where that particular logic applies completely. But in smaller cases, I think, I think it's much easier to manage. For example, like I have a folder and it's just basically I have WordPress, I think I call site plug-ins I bought. And I have all these different things. For example, there's one, you know, with your body tag, it will tell you, it doesn't tell you the page URL, but it has another few things it might say, Node.js or a few other classes there. Well, one of the ones I found many years ago was adding the page template into it and adding the URL. So if you decide on it, because right now in your body tag, you have something like page-1213. And that will be the ID of the page. I don't want them to remember the page ID. Whereas if you put in the page URL, so if you're about that page, it's going to put in page-about-bash-us. So when you reference that in your CSS, everyone knows what that means. You know, it's very logical what that means. And instead of page-1213, who knows, who's ever going to remember what that is. So that's a small and slight buggy that I just throw in. It's a very simple one-liner filter, a very short filter, and it just adds that into it. And again, that's something I would just drop in. I would happily copy those things into a client area without a certain performance. You could have a hundred loads, and it's still going to be faster than using that one. So it's really quality of your buggy into what the buggy it is. Yeah, and I gave examples on the area of WordPress website. They had a massive big plug-in. It had 18 modules in it. They were only using two. And one of them was, for example, related to displaying related parts at the bottom of the product page. And that was, you know, and when I looked at how to remove that, it was again, it was just a remove filter or a remove action call. So now, there's something similar with the other modules you use. So just by adding like two or three lines, I know to remove that whole plug-in. So even though they're only using two modules, the plug-in had all those modules in check. How you can use, how you can use, but all the code is parsed. So now I've used it. So, you know, you can, from a customer, from a person, a non-developer want to do, it was a good move to put that in there, you know, otherwise they'd never figured it out. I had to go even myself. I had to go, well, it's a code to figure it out. But in small cases of that, I think if you can convert it into code, I think it ends up quicker. And it doesn't matter anyway. And then you've ended up with the function part of loads and loads and loads of filters. You maybe start it off from the wrong bits. If you're worried about a huge page, you can really slot it, because you've had to filter in all this code. There's maybe a chance that you start it off from the wrong places. And we're trying to do too many things, and do we actually need all of those things? Or the thing, more than the basis, we started off from those well away from where we find, actually, what we can get to in the end. But having to re-build all the way back, you know. Any other questions? I'd like the idea of the functional plug-in that you can turn it on and off. Is there a way of having that, that you can edit the code in your admin interface? Yeah, you can actually. Sometimes the editor, the back-end editor is turned off. But if you would plug-in, I think plug-ins, I think. I know the editor is on by default for the themes. You know, you can actually go into your actor theme in it. You pick the file you want. Actually, plug-in, probably I don't think it is. There's another plug-in called CodeSync. I was going to say that's another option, yeah. Which basically lets you manage your in this case, you can manage them. But they're generally done, I actually used to use that quite a lot myself, but I've stopped using it because you lose version control. So, like, if I'm maintaining and they can tweak to something, if I might, if it's code, that's sitting on my hardware and I've got it committed to a git repository and I write something and I can roll back. Where's CodeSync, it's the plug-in. Well, it's great because it's yet not under version control, so that's the only downside. That would probably be the easiest one the way to achieve what you're looking for. Somebody says, oh yeah, just copy this from your Facebook group and you just drop it there and it will be the one to activate. But again, it's just a stunning mistake it made, you know, 500 error, you might, you know, but after you can go back and actually it's in the database, the hardware. Yeah, these could even have to rename the plug-in or whatever it is. Yeah, so whereas, like, if I upload a mine and activate it, like, you know, if it's activated and then I upload one with a mistake, it's going to 500 error, I mean, you know, you have to FTP and take it out, whereas if it was in the database that could be even harder, you know, to find where it is in the database and, you know, remove it, it may be in a serialized area, you know, where they have taken all the codes and put them in one database entry and, you know, that could be a major mess. So, I don't know, I hope they store a bit better than that. So that's why, you know, if you put up a couple of code, FTP and you just zap it and you're flying, you know, you're back to where you were and then you can figure out what happened. You go through your error logs and whatever they are, all this stuff and the did go to WordPress top this morning Anything else? Okay, all the rest don't look so real, thank you. Let's give them a big round of applause.