 Perfectly. Thank you. Thank you, everyone, for coming. Thank you, everyone, on live stream and who's going to watch this later. Well, we started with raising hands, so I'm going to just continue. How many of you are using Windows and WPC-Li successfully? Oh, you brave souls. Okay, so if you manage to set up WPC-Li on Windows successfully, please write a blog post, record video, please submit it to official documentation for WPC-Li because you will help some other brave souls as well. And why you should do it? Well, WPC-Li is not just the most powerful thing you can use to do stuff to WordPress. It's also fun and not scary. Yeah, so I love terminal. I love everything in terminal and today I'm going to show you a little bit of WPC-Li, not all, just a little tiny bit. So when you first start, you don't really have to go all deep. You don't have to use all of it. You can start on first level and that could be a level like everything you can do in WordPress dashboard. You can do with WPC-Li. So all that there is creating posts, managing settings, users, plugins, everything you can do with WPC-Li. And that first level of using WPC-Li, I like to call Guilfoy level. But then you want to do more. You want to list Chrome jobs, everybody does. You want to export and import database. Well, WordPress dashboard, you need plugins, right? You can't do that with fresh install with WPC-Li. You can do it just with fresh install. You don't need any plugins for that. And if you include here search replace command, oh my God, those migrations and cloning are done in seconds. And this second level of using WPC-Li, I like to think of as Pied Piper level. But then you want to do more, of course. Yeah. Maybe you want to export just parts of database. I wanted to export just parts of database. I had a client with a large database. Well, their website clients don't come with databases, right? Not yet. So I needed only past six months for just posts. I didn't need all the custom post types and million users and oh my God, theme settings and everything. I just needed past six months for specific post type. And I could do it with just one command. But that's not all for developer. I really love scaffold command. With scaffold command, you can, well, scaffold all the things like blocks, which will be deprecated soon. But plugins, themes, custom post types and many other things, we will see that today. And in WordPress dashboard, you can't do any of that. There is no plugin for that. So now if you compare dashboard and WPC-Li, it's the same. It's not competition, okay? It's just this tool is very convenient. So this new level of using WPC-Li is new level. And now you think, okay, so we reach the level where you can't do anything with dashboard and now this is it? Well, no, no. There's still more. With WPC-Li, you can scaffold your own custom WPC-Li command. And some very smart plugin authors and hosting companies are doing that for years. Can you imagine you get new project and you log into hosting and oh, my Gutenberg. They have SSH. But then you dig deeper and you find out they have WPC-Li available. Now you're flirting. But then you go even deeper and you find out they have their own custom WPC-Li commands for you to do things with their servers. Now that new level of awesomeness is Mr. Rover level. So you can see now you can use it at level that is comfortable to you. You don't have to go very deep. You can start easy. And now you want to start, right? I convinced you. So let's start using it. First, I get a lot of comments. People get scared like they have to memorize commands. Well, you have to memorize PHP function as well. So let's drop that right away. But there are things to help you memorize commands. So every WPC-Li command tries to be consistent. So you start with WP. And after that, you have none. Sorry. And this is the entity you like to work with. There are a lot of entities. And you can see all of that with just typing WP help. And you will see all of them. Or you can just type WP and tap, tap, tap. And it will list you all of it. After that, we have verb. And this is what you want to do with this none. So you will find a lot of entities having the same verbs, such as add, create, remove, generate, delete. And also here, you can always use help to see what verbs are available with command. And after that, if this is not enough for you, you can use flags, which are parameters or arguments depending on the command. And you can really refine it to make it work for your own use case. Now, at any point, you have help available. And some other global parameters. And we will see my personal favorite, the most beautiful parameter in the whole world, which is prompt. And it will save you so much time. So now that we know some basics, you want to start using it, right? And I don't have computer or server without it. But there is a very useful documentation. So all you need is three and a half commands. But basically, just this one. So what you do is you just download it and it's working. You can test it with this half of command. But you don't want to type PHPWPCLI.par every time you want to run command, right? You want to just make it quick. So what you do is you make it executable and then you move it somewhere in your path. Now, this WP is what you can define how you are going to run command. You can call it whatever you want. Just, you know, keep in mind that once you start using it, you will do a lot of copy pasting from Stack Overflow and documentation. And WP is something that is common. So keep that in mind when you start using it. Okay. So now we can dig in. What I first want to show you is a little bit of administration. So let's consider this scenario. You had a client, you haven't worked with them for a long time, but you did build a website and they didn't call, didn't write anything. And now they send you email and this email says they cannot access their login URL. They tried everything they knew, WP admin and login and they just cannot access it. And this is because you were smart and you changed the login URL to increase the security of website. And you even advised your client to change it again so that even you don't know it. And for the sake of the example, let's pretend they did it. Yeah. So they changed it and nobody in the whole world knows this login URL. So you have two options. You can go to database if you have access and search for it, which is boring or you can run one WPC like command because we live in a perfect world where every server has WPC like and we have SSH access to it, right? So what we can do, yeah, we can say SSH. This is my imaginary client and my port number and we are there. So if I say WP info, I have it. It's not the latest version but it's there. And this is all great but the problem is I haven't worked with this client for a while. I don't know that port number. I don't know where is the file where I wrote that port number. I don't know if we still have that file, right? And I hate memorizing things. When I memorize a port number, something very important just leaves my head. But with WPC LI, you don't have to memorize anything. There are aliases. You can create alias for every website, remote or local that you are working with. You can create alias for groups or websites. If you want to do stuff in bulk, just don't overdo it, please. So how do I know if I have this alias for this client? I haven't heard from him. Well, now we can check it with WPC LI, alias and list. Now this is the entity alias and list verb and I have to use WPC LI because alias is settings for CLI on my computer. It has nothing to do with websites that I have here on this computer. So this is the configuration of WPC LI on your computer. And here I have O. This is automatically created when you create one custom alias and I have a client. Obviously, this is my client. So I used all of these to log in. Now, at this moment, you have to know you can't just create alias with the remote server. You first need to have SSH connection with that server. So I'm not going to cover that. But what I did basically is three stuffs. I created SSH pair of keys on my computer then I copied the public key to the server and then I log in with SSH first shake of servers and that's it. And now I can create alias for this remote server. So how do you do it? You say WPC client and there is even tab completion. Oh my god, it's beautiful. So while I'm there, I can check the core version, for example. So you type name of the alias and the rest of command as you would without the alias. It's up to date. That shouldn't happen. This is disappointing because this client didn't log in for a long time. They forgot their login URL. So we are going to just degrade it right now. So when you want to change the core version, you're going to say core and update. It doesn't matter which way you go, you will use update. So if I just use this command, I will update to the latest version of WordPress. But if I want a different version, I have to use flags. So I'm going to say version equals. And I don't want to break it too much. I'm just going to say 5.9. And because I'm going backwards, I need to say force. And let's hope Wi-Fi is working. Look. Look, mano hands. And it's doing all by itself. You don't even have to go there. I suggest you do. So now we have successfully updated WordPress to back. And I'm going to do what was supposed to be done just to update core. But we are not here to play with this. We are here to find out that login URL that nobody knows. So thank you. I'm going to use command for executing arbitrary PHP code. And I used it more often than I dare to admit. It's very useful when you have to run something just once on server. And it's evil. So I happen to know what is WordPress login URL function? It's WP, sorry, login URL. And this is all that is needed. But I'm just going to add here a new line so that it's printed nicely. Here we go. You should have asked Milena. That is my imaginary client website. Now, this task in real world could take a lot more time. So client send you email and you replied, okay, yes, I can do it. But please send me logins because I don't know where is login. And then they say, oh, I don't know where it is. And then you start searching for it. Meanwhile, after two hours, they send you, oh, I found it. Then you log in and you find out you have to open support ticket. And a lot of things happen. You are frustrated. You spend time on that that you cannot log. You cannot say in your invoice searching for password two hours. You can't. But if you start creating aliases for every website, now you will have config file, a file where all your credentials are. And you don't even have to go there and open it because you will have it in aliases. And in two years, trust me, you will love yourself. And that's about boring administration job, right? Let's talk about security. Now, WordPress websites get hacked often. It's not a secret. And, you know, if we were in 2009, we could say, well, WordPress is a whole in server, right? But it's not 2009 anymore. WordPress is secure now. And we still get hacked. Why is that? Well, I like to think because we are popular, right? But you don't want your own website and website of your client to be a tool to measure WordPress popularity, right? You don't want that. So what is the problem? We often get weak passwords or some plugin, new plugin for sharing on social networks. But it was 60 bucks on that website and client found it for free, right? So some unchecked PHP code got into WordPress or just password was very weak. So obviously, this is the human problem. And the solution is there, right? In front of us. Just remove the user, right? No, no, we cannot do that. We build websites for users. So what can we do? Well, we can use WPC li to move everything that is dangerous and important on SSH level and give client the access they need. So let me show you. I have a local website here. And it's a fresh install. Just did it this morning. So it's updated. And let's see what users we have. I went with the stereotype. It's admin, admin, administrator. The password is admin. And let me show you which access this admin has. Now, I'm not going to show you this because I think you don't know this. You know it. And this is just to make a point, what can you do as an admin? So first of all, this WP admin command comes as a different package. It doesn't come with WPC li out of box, but it's just on command to install. And what it does, it will open a dashboard for you. So why we didn't use it with alias? Well, it doesn't really behave as expected with remote servers because different servers have different paths to WP admin. So it doesn't really, at this point, it's not really reliable. But for local websites, I don't memorize any of those URLs. Just use WP admin. Now, let's log in. Thank you. As I said, it's, this is something you all know. So there are posts and categories and tags and pages and teams and beta editor and plugins and all the users and oh my God, team file editor, plugin file editor. In 2023, we can edit PHP files from dashboard. If that doesn't scare you, I don't know. This is just a little horror story. And settings. So everything. This, the only user that we have on this website has access to everything. And by default, when you install WordPress, there is this first post published Hello World. And default teams always show this username, right? So now we have username and all we need is a password, correct? And we have access to everything. So what I like to do with this first user that is going to be author of posts, I like to demote them, not remove them, just demote them. So I'm going to use WP user. Let's actually see what we can do. Which verbs can we use with user? So we can add capability, add role, check password. And here we have consistency, create, delete, generate, get list, meta. Then we have removals and then spam. And with update, you can actually change the password of the user. So if you have friends, you want to have some fun, I'm not judging. And what we are going to do now is just remove the role. Now, WP CLI needs to know which user we want to remove role from, even though we only have one. So I happen to know that ID is number one. You can use ID or username or email. So I'm going to say just one. And what that means, when I reload, you see all is gone here. And I can try to go to dashboard, but nothing happens. And this is because when you have no role, WP doesn't know what to do with you. Even subscriber has access to the profile, but when you have no role, there's nothing you can do with WordPress. And I would suggest just keeping the password strong because you want to keep your hackers amused. You don't want to disappoint there. Just nothing to access. So this website is pretty secure, right? Well, we need someone who can do something there. So I'm going to create a new user. And now there are a number of parameters that you need when you create users. And I already told you, I hate memorizing things. So now we have our the most beautiful global parameter in the world, prompt. And it will prompt you with every parameter there is. You don't have to think if you are typing correctly, if you are memorizing, you don't have to think about anything. Just type what is unique for your own situation. So login is going to be author. Email doesn't really matter because we are in local. That's wrong email. Row by default is subscriber, but I'm going to need author. So I'm just going to go here with author. And you can see the square brackets. That means it's optional. So only those with code brackets or whatever you call them are mandatory. The others are optional. So row, I said author. User password. Now, this should be strong because this user can do stuff to WordPress, but I have to log in with them in a minute. So bear with me. Pretend this is a strong password. And everything else is just like on Windows. Next, next, next. Right? We had error for the wrong email. So let's do it all over again. And this is what happens when you do live coding. WP. We created user. Here we have admin without row and author with row and author. So let me log in with this user to show you what they can do. Almost nothing. So they have posts, but no categories, no tags, nothing. They have never heard about pages. They don't know. There are themes and plugins, and they will definitely not edit PHP file from dashboard. No settings, no nothing. Now, this is secured WordPress, right? Well, if this was your client, they would want more. But let's not just give them yet more. What we have now is one user that can only create posts and one user that cannot access dashboard at all. But let me show you what I can do from WP CLI. I can say WP plugin, install, activate. And I'm going to say simple history. Now, this little plugin will give you a list of everything that happened in your WordPress dashboard. But the point here is that I'm doing all of this while I have no user in this install who is able to create, to download and install plugin. I'm doing this on WP CLI on SSH level. And with this plugin, I could see in dashboard what happened if I had a user who has access to it, but I don't have. What I can do, I can see the list from here. WP simple history, history list. Now, you see this plugin author was smart. They created their own custom WP CLI command, and they've been consistent. So there is verbal list that you can use. And here we see, sorry, we see everything that happened, not much, but there is a list. Now, if you move everything that is dangerous to SSH level, you can avoid a lot of problems. But this client, as I said, would want more access and they should have more access. So the next row after author is editor. And frankly, I don't like how much freedom this editor has. So luckily, we have been WordPress capabilities. And with capabilities, you can give a little access, little permissions here and there just to keep things unique for every user. You don't have to do it uniquely for every user, but you can make your own role that can be applied to many use cases. So I'm going to give capability to this user. WP user add capability. And now again, I have to say to which user. So I know this user has ID number two, and I'm going to say manage categories. And what this will do, it will give them access to categories and tags. Personally, if someone can create posts, I think they should be able to manage categories and tags. Then I'm going to say switch teams. And I'm going to do the same for plugins, which is activate plugins. Now what this does, it will give access to teams but not adding new teams, not adding new plugins, just switching between existing themes and ability to activate and deactivate plugins. Now when something is wrong with your WordPress, the first thing you will get as advice from other, from forums and from support, it will be to switch to default team and to deactivate all plugins and then activate one by one to see where the problem is. So I think everyone should be able to do that, but without the ability to introduce some unchecked PHP code into your WordPress. So first, check with developer. All the breaking of the website, it's our job. Let developers do that and breaking and fixing. And what you should do is just create content. Now, this is, I don't know how much time I have left. Ten minutes. Okay. Okay. We can break the website, right? Yeah, we have time. I mean, we're talking about WordPress for half an hour when we didn't break it. So I'm not going to build a plugin here today or maybe I will, I don't know. So let's first break it. What we have here is default plugins. So I'm going to say WP plugin, activate hello, right? Let's break hello. Let's go to WP content, plugins. And here we have hello. And I'm going to use nano and do just a little bit of developers nightmare. Remove this. Yeah. So it's broken. So it says there has been a critical error. And yeah, thank you, but it doesn't help. For production, you wanted to have this error. You don't want to show what's happening on your website. But it doesn't help you at all. So what is the workflow here? If this was production, you download it and then you put it on your local and then you try to reproduce the error. And then when you find the error, you fix it and you put it on testing or staging. And then you check if it's fixed. And then you lost two days and your website is dead for two days. But with WP CLI, when there is error, you can run any command and it will give you the error. So just you want to make sure that you loaded enough WordPress with that command. So if you think of loading WordPress, it's core and then must use plugins and plugins and parent team and child team. So what you want to do is actually just run something with teams. So actually it's child team and then parent team. Right. So what you want to say is just, you know, team list, whatever. It doesn't matter. And here you get this error that is useless. But here you get PHP error. And you see where the problem is. So it says hello on line 46. Okay. Let's go and fix that. Go to line 46. And this was unexpected. So now we have fixed this website. In real life, error might be a bit more complex. And you might not fix it like this. But what you will know is where the error is, you can deactivate this plugin and let the website live while you take your time and fix that error in local. So, okay, we have now broke and fixed WordPress. So as a developer, I officially done my work. But now I want to show you, we have a little time. I want to show you scaffold command. It's my favorite command. So WP scaffold. Let's see what we can do with scaffold. Still you can create block. But it will be deprecated with newer versions because there are scripts for creating blocks. So there is no need to do it with WP CLI. You can create child team package, plugin, tests, post type, taxonomy, underscores if you are still into classic teams. You know, why not? So what we are going to do now is scaffold a plugin. Again, there are number of parameters that I don't care to memorize. And I don't have to. So prompt, slug. It will be WP Asia. If I can type right now. Asia. Okay. Directory name, if you want something different, I don't want. Plugging name. WP word come. Asia. Description, we don't have a time. Outer is WordPress community. URI skip test, no. Continuous integration provider by default is Travis. But if you want something different, you can define it here. Activate, yes. I don't have a network. Force, if I had a plugin with the same directory name, I could force overriding here. But I don't have. And we created a plugin. So let's see. Let's go to WP Asia. And this is what you have. In bin, you have some useful scripts. You can start writing your tests right away. There is grant file with one very useful task. So this is by default in older WordPress projects. Grant is task runner. Now, since Gutenberg, we have Webpack. But this is still working. It's great. Or you can convert it to Webpack. Whatever suits you. There is package JSON. So it's NPM ready. And I'm going to show you this read me file. So this is not just empty text file. This is everything you need if you want to host this plugin at WordPress.org. You don't have to go to documentation and copy paste or search what you need. Everything is there. Every file you need is there. And let's now create this plugin while we are here. Again, this is everything that we typed in while scaffolding the plugin. And my code starts here. So I'm going to say function. That's Asia. Always prefix your functions. And I'm going to pass title. By the way, these spaces, it's WordPress coding standard. Return, escape, HTML, always escape your strings and always prepare them for translation. And I'm going to say word camp Asia. My text domain is WP Asia. And I'm going to append title here. And this is my little function. I'm going to hook it to a filter. And this filter is the title. You already know what this is going to happen here. Title is my callback. Okay. So let's go and see what we done. Here it is. Our little plugin. And what it does, it adds word camp Asia before every title. I'm so happy it's not doing that anymore in menus. Yeah. So that filter is fixed. And this plugin is not very useful, as you can see. But what I did is I created a WordPress plugin on live talk in terminal in less than two minutes. And it would probably pass code review at WordPress.org. Not because I'm such a great developer. I am, but not because of that. It's because it has everything it needs. I didn't need to go anywhere to search what files have to be there. What is the standard? I just wrote my function. That's all. So help yourself. Don't reinvent the wheel. Just use what you can do with one command. You have everything you need. And there is help in your terminal. You don't really have to leave terminal ever in your life. And I'm going to do just a little magic. Do we have a time for magic? No? Yeah. Let's do a magic. One minute for magic. Well, that's all I need. That's it. This is empty. Magic. You know when magicians say this empty? Okay. So here, install database name is magic. My password. I don't need any of these. Site title is magic. Admin. And admin password is admin. You know that. And it's cooking. Yeah? It has to because it's magic. Not yet. Not yet. So do we want to release the Kraken? I want to release the Kraken. Hey, Kraken. Oh, I know. And here is my magic website. It's not magic. It's just a bash script that I used. Yeah. It is a little bit of magic. So let me show you what is there. No, it was WP install. So it has only five WP CLI commands. And some really, really basic bash scripting. So we download WordPress, then we create config file. And I'm getting some info from user input. And you can see I hidden my password here because you don't want your password in your bash history. And I'm using prompt. So you can do partial prompt like for parameters that you already know, but for parameters that you don't know you might need. So you can use that. Then the same thing with core install. And I'm using here rewrite rules. This is because with this first one that I installed, you see this index.php. That's what happened when you install website with WP CLI. But this one, if we go here, it doesn't have it. So that's because I did, sorry, rewrite rules here. And for that, you need to enable Apache mode rewrite. Yeah. And after that, we have some Linux fun like locomotive and these colorful letters. And I like to talk to myself when I do the terminal stuff. And then we have Xcow say that she will be my Kraken. And I use WP admin to open the website. So that's a little bit of magic. As you see, this is very basic. You can add here all the generate if you want to have a dummy content done. And you can just run the script and laugh out loud because you're not doing any of that manually ever again. And that's me. I hope you had fun. I hope you found out that you can do a lot of stuff. So this with WP CLI, this is just a tip of an iceberg. Trust me, you can do a lot more. You can make your life fun and easier. And my name is Milana Tzap. I'm a WordPress engineer at XWP and the loudest member of WordPress documentation team. You can find me on these places. I had so much fun. And thank you for your time.