 All right. Hello, everybody. Thank you. I Haven't even done anything yet. That's great. I'm just I'm just gonna bask in the glow right now Hi, I'm Peter Bayless. I work at a little startup in Durham called Percato My Twitter handle is up there at P. Bayless if you want to find me follow me bug me. I am available for that Percato is a little startup that is about Finding discounts on shoes, so we will not be talking about shoes today But but that's that's their business We are going to talk about speeding up your WordPress site Which I imagine even if your WordPress site is is pretty speedy You still might want to do or might want to know about and if it's not you probably really want to know about it So here we go All right, so so when I say like your website is slow you might be thinking like It's not that slow like maybe maybe you think it's fine But it turns out that that people are very impatient and and they always want your site to be a little bit faster Because they just they just want to move on they want to get to the next page About three seconds is is sort of the the baseline at that point like people are already leaving your site Some of them may have left already And so like if they're sitting there and nothing is loaded like that is just that's dead air That's bad. That's like me just sitting here and not saying anything And so you'll also find out that for SEO Google will penalize slow websites when they crawl your site they will record that and they will say oh well This site is faster than that site so people are going to like that experience better And so we're going to rank that site higher than your site So there are a lot of reasons to be concerned about this both for the user experience and for your search engine rankings And so I'm going to go through a lot of things Just sort of a survey Some of it is technical. I will probably lose you at some point Please raise your hand ask me questions if you're confused If we can't reconcile that in a reasonable amount of time then you can talk to me afterwards I will wander over to the happiness bar probably after lunch and And you know certainly just talk to people after the talk But we can just have a back-and-forth and talk about website speed and things you could be doing and So the first thing the first technical term I'm going to throw at you is this ttfb the time to first bite And so that is the amount of time it takes for someone to get anything from your website And so that's where you have that blank screen when you first go to that page the amount of time that you wait there That's the time to first bite. It could be in milliseconds It should be if it's in seconds. That is bad You don't want to be waiting a second staring at a blank screen before you see anything And then that could have to do with your hosting with your web hosting with your server performance It could just take that much time to contact something or start pulling that page It could be that something's just really slow on that server And what we want to do is kind of drill down and find out why and identify what the problem is and fix it You could have a slow theme. You could have a slow plug-in It's something within your WordPress site that's slow and runs on top of the server It could be individual resources. You could have a very large image. It takes a long time to load It's slowing things down. You could have CSS files and JavaScript files That are taking a long time Or maybe you don't know maybe it's gremlins. Maybe there's just something else going on that you can't explain We've seen that too Alright, so I've got a nifty graphic on the side there and the things I'm going over are going to relate to that You don't have to read it. I think it's pretty legible But I generated that by going to the WordCamp Asheville site actually And so each one of those bars has to do with how long it took something to load on that page And if you follow those links up top if you go to Pingdom or web page speed test You can get a graph that looks like that and you can put in the address of your site And you can find out All those things that you're loading from your site and how long each of them takes and so that is a waterfall view Because it just sort of cascades down like a waterfall. I guess that's what we call it You can also do the same thing within Chrome or probably within your web browser There's usually a set of development tools you can get to somehow In Chrome you can right-click on the page and it says inspect element and if you go in there It'll bring up the dev tools and there will be a lot of tabs and it will be Confusing but it has many interesting nuggets buried in there and it will do the same waterfall view And it'll have a lot of information and instead of being a static image It'll actually be a dynamic thing that you can click through and play with and find out more information about all the resources So if you're really interested in why something is slow, that's a great tool to play with And so each one of these all the waterfall views you'll encounter pretty much tell you the number of things you load The size of each thing What type of thing it is if it's an image if it's a script file? and so you know if you see a really long bar like Like whatever these four or five things are down here They're obviously taking the most time because this is like a timeline And so those are actually images I think those are like sponsored images I think there's probably like like PNG files that someone just uploaded were there like 200 kilobytes. I bet that's fine So this is actually a pretty fast site. There's no scale on here. You don't know how many seconds that is And at the beginning you see that short bar at the top That's the actual page and you see it starts to load immediately and so that's good You have a good response and by the time those down there loading You probably can't even see them because they're further down on the page So this is actually not a bad waterfall chart What would be bad is if you had the long bar at the top and you're taking a long time just to get to the page and And so that's that's sort of the basics of of waterfall charts I'd like to talk a little bit more about the chrome dev tools themselves They're excellent tools if you use chrome just please use them if you have an issue to troubleshoot I'm going to talk about two pains in particular for this The networking pane is the one I told you about that has the waterfall views It tells you every resources that load if you click on any of them It will tell you detailed what's the size when it started to load all the details about it And you can inspect and debug and drill down into anything you can see exactly what loaded if you click on an image It will show you a picture of how it loaded You can get into like just detailed like script responses, and so that's the the pretty json views json is the JavaScript object notation, so if you have a variable in JavaScript, it's in json And so you can open that up and see All the different things Who have I lost at this point? Just completely confused. No, I'm not doing my job Okay, next we have the audits pane and this is great Because this is actually a human readable Report, you know before I'm telling you to do all the work go through the waterfall view figure it out That's what I like to do, but some people just want a summary They just want you to tell oh your images are slow The audits pane actually like they added this more recently and it gives you a lot of great information So you can run an audit on a page, and it will give you a report and tell you And it will simulate a slow connection by default and why you want to do this is because like Let's say somebody's on a mobile phone And they only have 2g and they're trying to load your web page you might not have designed it for that You might not have thought about that use case, but it happens And so then you want it to load really fast, you know You might be on your desktop at home with a nice internet connection thinking my pages are really snappy But when you're on that phone, they're not and you aren't looking at it And this will try it like that first and then you'll say oh my website's really slow don't freak out It's not that slow not most of the time, but it could be faster, and it would help those people if it was And it will it will build that whole report. It has just so much information and There's also a chrome extension. There's a lighthouse chrome extension the tool is called lighthouse It's from a third party, and I believe Google licensed it But it still shows up in the audits tab and chrome by default And there's also an extension that you can use just like so you don't have to open the inspector and get in there You can just click that button and get a report for the page. You're currently on So that's pretty much everything about troubleshooting any questions about that So let's talk about images a Lot of times people just have really big images, and they might not even know that they're big images Your phone is amazing. It takes huge pictures. They don't need to be that big on your website Cameras these days are amazing DSLR cameras are incredible. They take enormous pictures And so you're gonna upload that into WordPress and by default WordPress will have that full-sized image It doesn't always load that full-sized image, but it might depending on where you are on the site WordPress tries to resize your images down But you know it doesn't always fix it for you not by default not out of the box and so If you have a photo just like a straight up you took a picture of a person or something Or a scene a beautiful landscape You want to use JPEGs for that and probably you already do when you take that photo on your camera But maybe you got a stock photo. Maybe you got a photo from somewhere else Maybe you got a really high quality bit of artwork that's used for a designer and it's in a PNG Even though it's a picture of a person or a landscape You don't want to upload that directly into your website as a PNG. You want it as the JPEG Yeah, you don't want to do that You can actually download that picture and you can upload it again And so here's the thing there's a plug-in called insanity and I recommend this It's great for a number of reasons It has you can put in a maximum dimension for your image uploads You can say I don't want anything that's wider than 2,000 pixels or 1,000 pixels if you know you're never going to need that on your site You can set a compression level so by default WordPress defaults to 82 for a JPEG compression level You don't want it to be a hundred. It doesn't need to be that high quality and some of these stock photos Even if they're JPEGs might be like a hundred There's also an option in insanity that you can check to say convert PNGs to JPEGs for me And so if you know you're never going to want a raw PNG on your website You can do that and then when you uploaded it it will automatically get converted to a JPEG And that's really nice And so that's the situation if you had that plug-in and you went in the settings for it And you checked that box then the next time you uploaded that image you could just download it Delete it upload it again set it as an image in your post or wherever you're using it And then it would be converted to a JPEG for you Okay, well, that's nice that that probably does a pretty good job on images But I don't know that would automatically convert it for you, but we can take a look at that later There are also other tools you can use to optimize your images if you're on a Mac There's a great tool called image optum that will try to recompress your images It will do a good job of just crunching them down without losing any detail There is an option in there for if you want to actually reduce the quality as well and still have it look okay But that's not turned on by default. So if you just get image optum out of the box It doesn't change the quality of your images, but it tries to make them smaller in file size There's another tool called image alpha that is just for PNGs That's for reducing the number of colors and still having it look good So if you need to have a PNG because you need to transparent image Then you can use image alpha to try to reduce the size if it's really big And then there are similar tools on windows I'd say equivalents to those two are file compressor and color quantizer Respectively so file compressor is like image optum on windows it can crunch down images Color quantizer is like image alpha. It can reduce down PNGs If you're on Linux, you can probably figure this out for yourself But but that's you know just handy gooey tools for Mac and Windows And then if you have logos or line art SVGs are good for that So you wouldn't convert something to an SVG probably But if you were using illustrator or something you might have something as an SVG And you can use those on the web now and they'll display it like pretty much fine And they're usually pretty small Although you know again, it's always worth looking at the file size to verify that What is it Scalable vector graphic is what SVG stands for so it's line art and then the lines are just like clean strokes Right right there you go All right, so maybe your problem isn't that your images are just too big Maybe your problem is that you just have too many little images Maybe you've got a gallery on your page Maybe you've got a wedding website and you've got like a hundred images or five hundred images There's some crazy amount of images that you had that you took And so there are lazy loading plugins. There's a plugin called lazy loader There are actually a lot of these if you look for this feel free to try them and see what works for you I like lazy loader. There are different ones And what it will do is it will only load the image If it's on the screen And so when you scroll down it'll be pulling in more images and usually they'll be pulling in Before you even see them because usually these things happen pretty quickly But it doesn't happen quickly if it's trying to pull in 500 images at once it happens If it's just pulling in a few images at once it can just devote all those resources to those few images and load them faster Also, this helps the page load quicker when you just first load the page Because it doesn't have to load everything because you aren't looking at it yet by default browsers don't know what you're looking at They're they're trying to fix that Google is working on that They're trying to get lazy loading just built into Chrome But at the moment, you know, you still want to plug in like this because not all browsers would do that Also, there are sort of more technical ways to combine images together There are tools for building image sprites Which is literally like a big image that has a bunch of little images in it And you just show little parts of that a lot of websites use that for Things that show up on a lot of pages and so like again with Google if they have like they always have the logo And then they have a couple arrows and then maybe have some dots that they display for pagination Just different design elements. So a lot of times a design shop will combine that together into an image sprite So it only has to load a single image and then they can use CSS to just selectively show parts of that image And so that's a neat trick There are also data URIs you can actually put an image into your CSS Into your style sheet by encoding it into a data URI You don't really want to do that for a big image because it takes up space and your CSS is loaded across all your pages usually But you might want to do it if there's an image that just you know shows up on all the pages Because then when your CSS file loads those images also load along with it and they're just referenced in the CSS So that's another neat trick Now I should say the only reason you do this at all is because HDP The transfer protocol on the web Used to be very slow for having a bunch of resources that it has to fetch Because it would get each one and have to talk back to the server And so there's a newer protocol called HDP 2 and if your web server supports that and if you're in the chroma Inspector, it will tell you it will tell you what the protocol is for all the connections So it'll say HDP slash 1 HDP slash 2 different things If you see that slash 2 then you'll know that it's actually going to be faster for having a bunch of small resources because it keeps that Connection open so it doesn't have to keep talking back It just says give me these images and it just streams them all through that open connection And so then you don't have to worry as much about having a lot of small images They still load pretty fast or a lot of small CSS files or a lot of small JavaScript files So if you know your server is HDP 2 then the number of resources isn't as important It can still be important because JavaScript files can load other JavaScript files So you could be waiting for something to load that and if it was minified it would just pull in one JavaScript file But in general that speeds things up for small resources But you would need to make sure that's configured on your web server or have somebody do that for you If you don't know how to do that So that would actually be like a configuration file in a setting on a server That someone would have to change and restart and it might not always work And you'd probably want to test that out somewhere else first before you go taking down your server if you're using that for anything If you do just have too much CSS or JavaScript and you want to compress it or minify it together There are a couple of good plugins for that One of them is called auto optimizer or auto optimizer Somehow they just thought to just stick that 1.0 in there and I don't know if it's British or how you say that And then there's also BWP minify So between the two of those I'd say auto optimizer probably has less settings, but they have like a button to see more settings They're both pretty robust A danger with minification is it's always possible that something could minify Incorrectly and you wouldn't see it right on your site So it could break your layout or it could just cause a script to give an error These two plugins are usually pretty good But they also have some options for if you know there's a script that causes problems to say Don't minify this one script minify everything else together and then this one That's a problem just keep that one out and usually it takes some trial and error to figure that out if you have that problem Where you need to troubleshoot like which script you have to sort of play whack-a-mole and say okay Is that this one is that one maybe just disable half of them and narrow it down You know, hopefully you won't run into that but that can be a problem with minification All right, so now we get to caching plugins. Maybe you've heard about caching The basic idea is that you just want the server to Render and output whatever it's going to do and then you store the result and the next time you can just give them that saved result and so There are two really big caching plugins in the space. There's WP supercache and W3 total cache And they sound kind of similar But they're they're pretty different WP supercache is definitely simpler When you first enable it and turn it on so the good thing is is you know, you have sort of less options to look at However, it also does less. So it is a simpler plugin actually It does page caching and that's great if that's all you need You know, so it will you go to a page if you're not logged into WordPress It will save that out and it will serve that same page to everybody and sometimes that works fine And and so that's that's sort of your basic. It doesn't cache things from the database. It doesn't cache Objects or code and WordPress on your site things that it generates Intermediate results. It doesn't do that. It just does the page just HTML and then it serves that fast And so that's that initial time to first bite. That's what we're optimizing here W3 total cache the great thing about W3 total cache is it's got a lot of features The problem with W3 total cache is that it's got a lot of features Yeah And and it does it does have a page cache. It also caches objects. It caches things from the database It is the all singing all dancing bear. It does all the things You have to go through and configure it. You have to be very careful with it You have to know what all these options are But if you have a complicated site, it might be worth that pain to get that payoff to speed up things You wouldn't otherwise be able to speed up if you have a simple site. You probably don't need it at all It also has a minifier built in never use the minifier I've never had luck with the minifier that's built into W3 total cache That's why I recommended two other minifiers before I even got to it Yeah, just don't even turn that on pretend. It's not there, you know, if it works for you great I've never seen it work But other than that, it's a great plugin. I don't know why the minifiers busted And then for the object caching specifically if you're programming in WordPress, you can also use the transience API So if you're a developer, it's a way to sort of store information for those intermediate results And then that way they will show up in the object cache So if you're aware of that if you know you need that you can program to be aware of Putting things in the object cache when you're using W3 total cache. That's sort of an advanced tip Also, if you're doing that there are different backends for the object cache So these are other programs that store that information. I like to use memcached. It's pretty simple It's a basic key value store. So you're you know looking up data by name In memcached and usually that's pretty good You would have to also configure that on your server to run and then it would show up in W3 total cache And you could say use memcached for the object cache. So again, if you know you need that that's useful So you do all this and it's still slow You've done everything you can do. You don't know why it's still slow Maybe it's your web host If you're on shared hosting don't use shared hosting It could be somebody else's on your server slowing you down and the reason you got a cheap deal on that web Post is because of that is because there's eight other people and one of them has a big site and it's just falling all over I don't think that's as much of a problem as it used to be But it used to be people were just on cheap posts and it could be very slow for that reason You know and sometimes you do get what you pay for For the web server if you control your environment Consider using engine X over Apache Apache was sort of the default web server that everybody used for a long time And engine X came out later and it didn't have as many of the features as they had maybe 90 percent of the features Than Apache Apache is very full featured, but engine X was a lot faster. It was just focused on performance So, you know, if you if you know what all those letter mean letters mean then Consider setting up engine X on your server Otherwise go to a host that does it for you and see if that says that when you signed up for that host Along with engine X it plays well with PHP FPM, which is a specific server for running PHP And so those two together very speedy combination. That's just pretty good out of the box. They work well together If you do all that and things are still slow There's another static page cache that it again runs as a server in front of your web server called varnish and you can set that up and If varnish is too hard to configure which it usually is varnish is pretty complicated You don't always know what it caches. You don't always know how to flush the cache If you figure all that out, you're probably a varnish expert at that point You should probably start a company like fastly because they've already done this They just put their varnish servers in front of your server and you can use it as a service Cloudflare in general works the same way But it's it's sort of in the CDN market Cloudflare is an interesting company because they started out trying to be a security company and they said we're gonna protect people from Attacks and people were like we don't really care about that But you sped up our website and we like that and so Cloudflare was like we're gonna speed up your website They they pivoted they they changed that entirely But but they they start out as a free service and you can have Cloudflare in front of your website and it'll speed it up Or if their servers are down then you'll see a notice the Cloudflare servers are down This is the problem with having somebody else's server in front of your server I've seen that notice before too, but I expect on balance. Usually it's faster There's also CDNs I should mention CDN stands for content delivery network The idea is that they have a lot of servers all over the globe and it tries to use the closest one geographically to where your users are So if you have a web server that's in England and I'm in California, but you're on a CDN Then maybe it fetches it from closer to California Because it has just different servers where they've mirrored all your content so that can go out and find it That's what that service is There is in the jetpack plug-in there is a free image CDN called photon And so if you're using that it will store your images on their servers and that will speed things up And so you can just try that out and see if it works for you if you have slow images and see if that speeds it up Also way back in the beginning when I mentioned the waterfall tools. This is a test You can actually use them to test from different locations So in Pingdom, you can say try it from the West Coast And it will use a server there and tell you the speed from there So if you are concerned or you know your customers live somewhere else you can try that out Yes, okay, so I just got a cloud player excellent To go with the short pixel plug-in right right, but I have clients two of them that have lots of pictures And I need to get them onto a CDN One of them is a newcomer, so they already have jetpack. They're using it. Nice. Should I use the photon one? Yeah, yeah, if you if you already have jetpack try it out You know because it costs you nothing to just check that box and photon And and see if it works and see if it speed things up and that's by far the easier solution if you're just doing it yourself You know if on the other hand you want to speed up the whole site if you know there are slow other things that are slow other CSS JavaScript, and it's not the images that are the problem then consider cloudflare because photon will do nothing for the rest of it It just is an image CDN Yeah, yeah cloudflare is like just having something in front of your web server that serves all your content But it does it from different locations And so it geographically tries to be smart and pick the best one if it knows that my IP address is coming from somewhere else Right, yeah cloudflare is everything. Yeah Photon is just images, but if images are the problem, maybe photon is enough. So that that's sort of the trade-off And so if you've done all that and things are still slow Maybe you've optimized your website and you just have a lot of traffic. Maybe you're really popular This is not a bad problem to have hopefully you're making money on this if you've got a website that operates that at a large scale And at that point you can afford to invest more in infrastructure, and so then we're talking about scaling out And so maybe you need separate or multiple front-end servers Maybe you need different servers serving the PHP and the images Even though you have the CDNs the CDNs eventually have to talk back to your server And so you're still getting traffic. You're not getting as much traffic, but it still needs to be fresh It still needs to update sometimes Or if you have like a membership site if everybody logs in it might not be able to cash as much because you need specific Profile information you need, you know, and so it can't cash all that if it's like my user isn't the same as your user So like Facebook, you know, they operate at scale. Everybody sees something different. That's a hard problem That's a lot of you know, sort of combinations of things. Everybody's wall looks different. They change it all the time That's hard to cash. You can't do a static page cash for a long You know, maybe you can do that for like 30 seconds, but you know, you can't do it for 15 minutes as people are still refreshing it There's HyperDB Which is again sort of low in the WordPress stack It's something that you can put in there for talking to the database for partitioning and replication Hopefully if you if you you know if you can figure out what I'm talking about there, you know, you might know about it or need it The idea is that, you know, if you have a WordPress multi-user site You might have different Different sites that are on sort of like different databases and HyperDB is how you would do that So you could say like on this, you know on this MU site You've got like 200 servers on the site. So maybe 20 of them are over on one Database server and 20 are over on another and you can you can parcel it out like that. So that's sort of scaling out On AWS on Amazon web services, they have a product called Aurora They can do database clustering so it'll look like one database But it's actually multiple servers clustered together and they can have multiple Readers and writers and so you can have just sort of different servers Serving that so even though it looks like you're just talking to one instance It's actually faster because it's coming back faster because they have multiple servers on the back So that's sort of again high-level scaling But that is an option. I mean you could do that you could set that up You could completely over engineer your blog on Amazon web services and be ready to operate at scale And then realize you're just paying too much money because you're not getting that much traffic yet Or maybe you need it and so that that sort of concludes the basic performance optimization piece But I wanted to talk a little about Sort of more more technical With the WordPress REST API it's possible to just dynamically pull in content So even if you have a static page if you know you have one dynamic element You can have the REST API pull that in and so the example I wanted to use was something like a fortune like a fortune cookie or like a quote Maybe you have something that you randomly want to rotate on a page Typically that doesn't work well with a static page cache You know you wrote all this this PHP code or somebody did to get a random quote You installed your static page cache and now it's the same quote all the time or it's the same quote for an hour Because it cashed that static page And so this is an example of how you could do this with the REST API and have it just pull back new content every time Because that's in JavaScript And the JavaScript is on the client side then the client just fetches the new quote every time and they could reload The page every second and pull back a new one, but the rest of the page is still static So the page loads fast and then that content pops in and So this is if you go to github.com slash P. Bayless, you'll see this WCAVL fortune repo There's one file in it I'm going to go over most of it in the next couple slides if you don't understand what's going on there Don't worry about it So the first thing you do with a post type is you register your post type And the key thing here is there's this show in REST flag when you register a post type And if you set it to true then you can use that in the REST API And if you don't then you're going to be like why is the REST API broken? I can't see my post type and it's because you didn't do that And so that's the the key thing if you want to use the REST API to pull post out of a post type It has to have that show in REST flag set to true when you register that post type So here I'm registering a post type called WCAVL underscore fortune And then when you do that you'll see like a fortune label and the WordPress admin and then you can post fortune posts And that's your basic how you create a post type and you would have that code in a plug-in Which I have on that GitHub and then this is your basic code to fetch one of those fortune posts I put this in jQuery because this is actually shorter If I had written it out and just draw a JavaScript it would be longer I'll show you that next and we'll just completely gloss over it because it's way too long to just read on a slide But yeah, here you have you have a div at the top it says show fortune I gave it an ID And then you're going to put content into that div. So that's your placeholder So this is still static you have a static div. It has nothing in it And then this is your script and then in the script you see that Ajax right there That does your Ajax request it pulls it in from a URL on your website The slash WordPress slash is actually hard-coded. I probably should have done that But that's where my WordPress installation lives if you're doing this, right? You would want to use something like site URL and pull that in And then you have the rest of the URL to it. And so that's your usual rest API URL So the WP JSON I told you about JSON before it pulls things back in the JSON object model It's a JavaScript variable Slash WP slash v2 slash and then the name of my post types there's the WCA BL fortune and then Slash question mark and then we have the options for pulling things out And so this is what you'd see in WP query So that's the post per page the offset and so I'm saying Perpagination is one you only want one page one one one post The offset is how far you seek in there and so like maybe you're just going through like three posts or something But I don't have that set to a number because if I hard-coded it to three you would see the same post every time And so I have some code here some more JavaScript to say, okay I want a random number and then multiply that by the total posts and give it to me as an integer and So say like and then that might come up with post three or might come up with post four And then it fetches that post data and once it's done We shove that post data back into the show fortune div and then it just pops in and so that's the basic idea behind this code And so that that's sort of the the amount of effort required to do something like that or If you weren't using jQuery it would look more like that and that Probably looks like more work and you know actually I can still read that from here I was thinking I would have a smaller screen, but that's still probably too much to go through on the slide So, you know, that's why people use jQuery folks Everybody's like oh you can write it in raw JavaScript. It's the same thing. It's great. Like you're you're writing more moral letters So it's that trade-off, you know Do you want to spend the time loading the jQuery library on the front? And then having to wait for that file to load or do you want to spend your time writing longer code? And then you know waiting for that and you're like well, it's less kilobyte. Yeah, but but you spent time doing it So there's always sort of that trade-off between libraries that help you and more code to load in on the front Versus more code for you to write because you didn't use that library Now we talked about the REST API and the REST API is great But there's some overhead to it because every time you make a REST API call in WordPress It has already loaded all your plugins It has already loaded the theme and I told you guys I just want one post out of this fortune post type Do I need an SEO plugin for that? Do I need a caching plugin for that? I'm not caching it. I'm just I'm pulling the post back So there may be some you need there may be some you don't and you want to sort of step back and look at that and say Okay, is this fast enough or do I need to make it faster? Is it taking too long for that quote to pop in if it does it taking two seconds to load all my plugins in my theme every time? and so This gets pretty technical and that you'd need to create a must-use plugin to be able to override other plugins And so that that shows up in the WP content slash mu plugins directory Most of the time, you know, if you don't know what a new plugin is you probably don't want to be writing one Because that's getting just sort of into the more dangerous. It's basically a plugin. You can't deactivate It's always running. You don't even necessarily see it on the plugins list. There is a tab for it But you might not even notice And so it's just for things that you always want to run And in this case it would just be very short and it would just check and say is this URL going into the rest API If so, maybe what rest API call is it, you know, is it this fortune one? And then if so Don't run these other plugins and it's powerful. It can do that because it loads before the plugins load So it can tell WordPress not to load things And so that's what this option action active plugins filter is The active plugins option controls all the plugins that load and so you can grab that and you can manipulate it before the plugins load And say don't load this one. I know this is slow. I don't need it for the rest call I'm going to just deactivate it. It doesn't deactivate the plug-in like in the admin It's just temporarily for that request that plug-in just doesn't even load and no one's the wiser Because you decided I don't need it for this And so that's just getting sort of into the into the weeds of the fine tuning of WordPress But that's what you do when you really need to speed things up There's also a constant in WordPress called doing Ajax that was used sort of in the legacy previous Ajax system If you remember WP admin admin Ajax That's where we used to do Ajax calls and that still has a lot of code in WordPress where it would say Oh, you're doing Ajax. You don't need to do this And so you could set that and that would also speed things up before the rest API even loads in that same way So that's sort of another hack that you can do If you need to really speed up a rest API call Also going even deeper than that You can have a standalone PHP script just for doing rest API's and bypass the rest API entirely And there's a short knit constant and that if you enable that first it doesn't even load the plug-ins It doesn't load the theme it doesn't load most of WordPress But if all you need is a post you might be able to pull out a post with a little bit of WordPress It does load so that's super fast, but it also gives you almost no functionality And you're hitting just like a standalone PHP script. That's just barely talking to WordPress So I'd say for most use cases you don't even need that that's probably overkill But if it has to be really fast, I was actually talking to Michael wood earlier And he was telling me a use case for this and I'm just going to steal this and tell you And it was like an autocomplete, you know So you know when you're live typing and then it comes up with the suggestions But it updates every time you press a key They needed to do that short knit solution because that was the only way it could be that fast Because if it took a second or two seconds to load a theme or all the plug-ins and every time you're waiting to see what happens When you press that key you would not use that autocomplete you would not type into that search field But if it comes back in 50 milliseconds, you can type just fine And so that was the use case and so it doesn't happen often, but it can happen And then you can also cash responses from the rest API so for this fortune example Maybe you've already seen this quote before but it pulls it in again when you read the page because maybe you've gone through all the quotes And so then it would pull it back faster because it's seen that rest API call And so there's a plug-in called the WP rest cash I don't personally use this because I had sort of a custom Solution I did where I actually sort of compressed the things first and it's a little complicated But for simple rest calls, it's great And it actually adds some filters in front So there's this rest rest cash headers filter where you can actually send special Headers to the browser and say like, you know, I want to cash this for 900 seconds or something You can just specifically control that And that's a nice feature that they added And so I'd say like as a developer It's useful sort of looking into that WP rest cash plugin and seeing what they did and how they did it You know at least as an example Alright, so at this point we're probably overdue for questions Anything you guys want to know about or talk to me about or questions you have about your site doesn't have to be You know, hopefully you're talking about speeding it up, but other than that Anything I'm just gonna assume I went through all the things and did a great job But feel free to talk to me afterwards