 So thank you so much for making the trouble to say my last name correctly. So it's a Slavic. Yeah, and Thank you all for coming Also hi to everyone who is looking who's watching the live stream, you know, wish you were here Full room of friends. So we don't have enough time We don't have a lot of time and have a lot of things to do. So let's just start WPC li is a command line interface for WordPress and Today when we have so many CLI tools, do we really need another one? Of course we do what? PC li is not just The most powerful tool you can use to do things to WordPress It's also fun and not that scary like at all and if we compare like Graphic user interface, which is WordPress and WPC li So everything you can do In fresh install of WordPress default team no additional plugins. You can do that with WPC li So, you know pretty much the same and this first level of using WPC li I like to think up as Guilfoy level But then you want to do more you want to list Chrome jobs everybody does and you want to export to database and import database and In dashboard you have to install additional plugin to do that With WPC li you can do it on fresh install without any additional plugins. So now They're the same and this second level of using WPC li I like to think of as Pied Piper level But you want to do more you maybe don't want to have Complete database Exported you maybe want to just have a part of database. I needed just post published in past six months and I was able to do that very easily in a few seconds with just one command and You can really refine it like he doesn't have to be past six months It can be what out there or proceed ease or post type or post type not in when you need all but not just one and Not just that with WPC li a lot of other things that there is no plugin Made yet, and I don't really need that plug-in. You can also Do some really really cool stuff like f-holding you can scaffold team plug-in block and many other things and we will see that today and This level We can think of as neo level. So now they are Still the same. It's not competition and there is more With WPC li you can scaffold your own custom WPC li commands and and some very smart hosting companies and Plug-in authors have been doing that for years now And it's so refreshing when you get a new sorry when you get a new project and you log into hosting and Oh my Gutenberg. There is SSH But then you look further and you find they have WPC li you're flirting now watch But then You look further and you see they have their own custom WPC like a man So you can do stuff on their server, you know in a second now this new level of awesomeness is Mr. Robot level so now you want to use it and let's start using it now I don't have any computer or server without it So I'm not going to show you how to install it, but there is a very good documentation and It's pretty straightforward. All you need is just three and a half commands So Yeah, it is so first you download it and yeah, it's working So basically you need just one command, but then you run this half of command just to check if it's working and It's working But you don't want to type PHP WPC li par every time you want to run commands. So what you do you made it executable and then You move it somewhere in your path I'm sorry this this type so musicians will appreciate this. You know, it's so cold here I'm trying to type and you know the fingers are just not listening. So then when you made it Executable you move it somewhere in your path where you can Actually execute it then from wherever and the most common thing is to call it WP You can call it whatever you want Just keep in mind that you will after installing this do a lot of copy pasting from Stack Overflow and people use WP So you are warned and now We can go and do this WP info and Now you see the info of your system you see Info about PHP and my SQL and I have the latest stable version of WPC li So before we start using it, there are a few things to keep in mind First of all every Command is doing just one job. So don't over complicated Don't try to make it do a lot of things it can do a lot of work, but it's doing just one job and another thing the Structure of command is trying to be consistent through all Command so you have WP or whatever you called it then there is none This is entity you want to work with and there are a lot of them and then we have the verb and This is what you want to do with this Entity and you will find a lot of entities having the same verbs such as add create remove delete generate list And after that you have different flags or parameters. So you can make your command really Do what exactly what you want you can refine everything and at any moment you have a number of global parameters available one of them being help and it's really helpful it has complete Documentation in your terminal. So you don't have to go there. So you have all the parameters all the subcommands and Even examples. So, you know, you can help yourself by doing that and we will see today another global parameter, which is the most My personal favorite global parameter in the world. It's mind-blowing. It's prompt. So we will see it and now We can start using it. So what I want to talk about today is I'm so sorry what I want to talk about today is a little bit of administration a little bit of security and Development and some magic. So first, let's start with administration consider this scenario you have Client you work with for a long time go and they didn't call didn't write anything And now they send you email and say they cannot access their login URL They try WP admin and Logging it just keeps sending them to four four page and This is because you were smart and you change the login URL in order to increase the security of website And you even advise your client to do it again so that even you don't do you don't know what it is and For the sake of the example, let's pretend they do everything we tell them to do so they changed it and Now nobody in the world knows the login URL and you have two options You can go to database and search if you have access which is boring or You can run one WPC like command because we live in perfect world Where every server has WPC like available and we have SSH access to it so we can do that go to SSH and my This is my imaginary client and my port number five five six five six, so if I go there and If I check I Have almost the latest stable version and that's fine, but there is one problem with this Sorry, there is one problem with this I Haven't heard from this client for a long time. I don't know that port number I don't know where is the file? I save that port number. I don't even know if I still have that file and Remembering port numbers is the worst thing you can do You know as soon as I memorize one port number I forget parameter or WordPress function that I use every day and that's not a good thing So with WPC li you don't have to Anything with WPC li you can use alias and you can use alias for remote Website for local website for groups when you want to do things in bulk just be careful with that you don't want to overdo it and Do I have alias for this client? I don't know maybe we have to check it So I can run WPC li alias List so here's that list that you will find with many Entities and think to know here is alias is configuration for WPC li on this Computer so it's not really Configuration of WordPress its configuration of my installation of WPC li and Here you can find I have all which is automatically created when you create one custom alias and You just use it, you know carefully and there is client So you see here all the credentials I used here is important to note you cannot just create alias Like this so this computer and that remote server have connection Through SSH keys and when you have that then you can create this SSH connection via alias So now let's go and see So when you use alias, you just type WP and alias name and then the rest of the command as you would without alias So while we're there, I'm just gonna check the core version of This website. Oh, it's up to date. So disappointing This is what happens when you change Routines before talk, but what I'm gonna do. I'm just gonna update it right now So you will see what I wanted to do. So I will say WP client core Update so if you want to update or downgrade you will use command update and because I'm going With the version that is not current latest. I have to specify version And I'm gonna say 5.8. I don't want to break it completely and because I'm going backwards. I have to say force Look ma no hands You don't even have to go there, but I do recommend just check if it's still there okay, so now we have downgraded and now When we check it. This is client. I haven't heard for a while from oh, it's out of date so we have to update it now and Let's pretend I did everything that they recommend like backups and all that so now When I want to update to the latest version, I can just do this core update and that's it But this is not what we were supposed to be doing with this client We were supposed to find that login URL and I'm gonna do that just right now So I'm gonna use command for executing arbitrary PHP code and I've been using it more than I care to admit. I love that command So I can just type whatever PHP I want and I happen to know what is the function in WordPress for getting login URL And it's WP Login URL and This piece is just I'm gonna add to to print nicely new line in terminal and it is you should have asked me on so This is my imaginary client. Okay So this task could take in real life It could take a lot of time If you didn't use WPC li that could be a time that you cannot log you cannot bill You know you send email to client. I don't have credentials and then client reply in two hours later I don't have either and then you go and search through your files and there goes the whole day Meanwhile client said oh, I found it so you go there but you find out that you have to open new ticket with support because something's not working and It could take a lot of your time a lot of time that you don't want to spend like that or you can start today Adding aliases to every project that you do and you have it in your config file All the credentials you don't have to memorize any of that You can just run WPC li alias list and you will find it there and in two years. Trust me You will love yourself So this is about administration making it a little bit faster and more fun And now I want to talk about security. So I'm gonna show you One local website that I have here So this is just freshly installed WordPress like since this morning and let's see what users we have so again, you see WP user list and You see here I have admin and this admin is administrator So for next couple of minutes I will be saying things that are obvious and you know that I'm not saying it because I don't think you know that I'm saying it because there's a point behind so bear with me and Let's see what this admin has what this administrator has as Access so this WP admin command will open dashboard and why we didn't use it with alias Well, because it doesn't work as expected with remote servers But it's it's very good. It doesn't come together with the initial install of WPC li So you have to install it separately, but go to the commutation see there. It's just one command and Let's log in now And now you will see some obvious things Okay, so this admin has access to all posts and categories and tags and pages and I'm gonna just Okay, and There are teams and there is a full site editor in beta and then plugins and tools and Team file editor plugin file editor in 2022 You can edit team and plugin files from dashboard and Setting so this this is what you know the this first default user has access to everything and When you install freshly WordPress you always get by default this new post that is published hello world and Most default teams will have this admin user Actually this username Displayed on the front end. So what is obvious here is this user has access to everything and Its username is displayed on the front end. So now we need is just password, right and WordPress websites gets hacked Often it's not a secret and there was a time when WordPress was this security Holland server, but this is not the time anymore. That's like 2009 now. It's more secure but it still gets hacked and You know, I like to think of it as okay, so we are popular kids whatever But you don't want your client's website or your own website to be the tool to measure WordPress popularity, right? and It still gets hacked. So why well There is this human factor, you know a lot of things that is human factor can happen like Installing plugins that are not really Safe or keeping your passwords light and jolly and everything so This solution is obvious. Just remove the user, right? But we cannot do that. We are building websites for people and We have to learn how to work around them. So I'm gonna do that now I'm gonna work around this Administrator and what I'm gonna do is just demote it not remove it just demote it, but first let's see what Verbs we can use with user So we can add capability add role Check password now here they come create delete generate get list. So that is the consistency Remove capability remove role Spam unspam with update you can actually change the password of a user So if you want to have some fun with friends, you know, why not and Now I am going to say WP user remove role By the way, do you see there's also completion so you just start typing and type I mean, this is beautiful. And now we have to tell to WPC li which user we want to remove role even though there's only one WPC li needs to know which user so you can use user ID or user email or username. I haven't to know it's just ID and This is what we have now This admin user and the role is empty and let's see what that means So if you take a look at admin bar There's nothing if you try to go to dashboard. There's nothing so when you have no role Warpress doesn't know what to do with you So it doesn't give you any access even, you know subscriber has more access They can at least see their profile But I suggest keeping this password very strong because you want to keep your hackers amused you don't want to disappoint there and Now we need someone who can actually create some content and I'm gonna create a new user So there is a number of parameters now to create user Some of mandatory some are not I don't know which well I know I practice for this doc, but I don't want to know I don't want to memorize and now we can use that the most wonderful global parameter in the world prompt and It will prompt you with all Parameters there are you don't have to type anything you don't have to memorize You don't have to worry if you're going to make mistake. You just do what is unique for your situation? So user login is username and I'm gonna say author user email Doesn't really matter because we are in Local, but it should be at least at Role so you see these square brackets that means it's not mandatory it's optional and The first two are mandatory Default role is subscriber and I want to be out there. So I'm just gonna type it here author and This password should be really strong because this user will have access But I have to log in with this user in a minute. So I'm just gonna say out there But you pretend it's very strong password and the rest of it I just don't care enter enter like installing something on Windows and Now Sorry, I'm Linux girl Now let's log out and See what this author can do Okay, so they have posts but no tags no categories No pages they never heard about teams and plugins and you know, there is no editor of files nothing they cannot even Edit or do anything with other people's posts. They can only create their own pop their own posts So now we have two users one of them has no access at all The other one has very very limited and in WPC li I can say plug-in Install and activate and I'm gonna say simple History now this little plug-in No plug-in system What did I do? There has to be some type of or something What Okay, oh Yeah, maybe it's yeah. Thank you. Maybe it's just Wi-Fi. Okay, so we installed this plug-in and This plug-in will give you a list of things that happen in your WordPress install And this list is available in dashboard if you have users who can see it We don't have those users, but what we can do is WP simple history Now you see this plug-in author is smart They created a custom WPC like a man to come with their plug-in and they made it consistent with list and From here, I can do I can see what happened and I can do whatever I want from WPC li so how about that security, you know making every dangerous thing and Every important thing moving it to SSH level. I think that's pretty secure website However, if that was your client They would want more access and they should have more access, but the next Row is editor and that is a bit too much for my taste So luckily what we can do we can use capabilities and capabilities are this little part of access and permissions that we can just add and make every Experience unique you don't want to make it every unique But you can find something between author and editor that will be secure enough I'm gonna say WP user add Capability and now again, I need to say which user and that is ID number two Sorry, I need to say also which capabilities so first. I think they should have a capability to manage categories Which will give them access to Categories and tags and I think someone who is creating content should be able to manage categories and tags after that I want to give them ability to switch teams and To do the same with plugins, but that will be activate plugins Now when something goes wrong with your WordPress install the first advice you will get from anywhere is to switch to default team or To and also to Deactivate all the plugins and then start activating one by one and see where the problem is So this is exactly what they can do. They cannot add new teams. They cannot add new plugins So first you have to consult your developer. There is no shiny plugin and you just want to install it You have to consult developer but what you can do is Activate and deactivate all the plugins and switch between the teams and also The teams and some plugins and even core are hiding some settings with behind edit Sorry Team options So that is also something I would like this Outdoor to have and here they will get this better editor that they can Manage menus and edit header and footer and some other things and there are many other Roles and well capabilities I Learned these for this dog But you can really find at WordPress org support article of roles and capabilities you can find a list of all roles and Roles are actually just groups of capabilities. The role is really nothing you can call it whatever you want It's a group of capabilities and you can find the list of all capabilities here So you can really refine it and I think it's our responsibility to find that line where Clients can have enough access to own the website, but not enough to break it and That's about it for Security I think and now let's talk about development the fun stuff So first as developers we do a lot of boring like I need dummy content so I have to create something to work with and Before WPC li for me that was like post Another post yet another post and it was empty and so useless and it wasted my time But with WPC li you don't have to do that you can Use the verb generate and a lot of entities have that Subcommand you can generate posts and pages and taxonomies and users and menus and many other things and Default number is 100 for each and there are parameters So you can really make it like the different, but that's not all At some point you will be bored by just typing all that so you can just put it in bash script and Run the script and laugh out loud because you're not doing it manually anymore, but that's boring stuff Let's do some interesting stuff with development. I said we can scaffold things and let's see what we can scaffold so We can scaffold block and child team and package and plug-in and tests post type taxonomy and underscores this is Stand-alone what we call now is classic team But so if you want to work with blocks, this is probably not your thing But it's useful to just learn what you can do and how it looks like so I bet you saw enough Blocks in these two days, and I'm not going to scaffold a block. I'm going to scaffold plug-in Again, there are a number of parameters. I don't care really. I'm just gonna prompt so the slug What comp us why not directory name if I want it different than the slug I would type it, but I don't want it World comp us 2022 description. We don't have a time out or WordPress community Outer URI skip test don't skip test Continuous integration provider by default is Travis, but you can define what you want here Activate please do Activate network. We don't have a network here and force if I had another plug-in with the same name of Directory then I would overwrite it with force, but I don't have I have only this one So let's go and see what we created So what we have here is been with some useful scripts you can run You have Ready test you can actually you can start writing tests. Everything is ready there We have package Jason so you can start using npm and there is grant file with I believe one task that will take all your Strings and put it generate a post pot file for translation Of course grunt was default task runner for WordPress projects before we get Gutenberg and now it's more Webpack, but this is working and it's good and you can convert it to that back if you want but what I want to show you is This read me file and I'm gonna open it in nano because we want to close it eventually, right? so This is not just empty txt file. This is complete template that you will need if you want to host Your plug-in at WordPress org So you see already the info that I typed in while sky scaffolding And all you need to do is just put what's unique for your plug-in You don't have to go to documentation and search. What's what files you have and now Let's create this plug-in. Let's make it do something. I'm gonna say nano again Again, you see here. There is This comment That you usually get and you don't have to go to documentation to find what should be in that comment It's already here and I'm gonna save function always prefix your functions the title and I'm gonna pass title Notice the spaces. That's the WordPress coding standard I'm gonna return Always escape your strings html and make it ready for translation and Here we will say what comp u s 2022 My text domain is working u s and I'm just gonna pen the title most of you know what what's this about and Let's hook it to a filter The filter is called the title and My callback is working u s The title all right Let's see if we broke anything Here it is. This is our little plug-in and what it does It just adds Word comp u s 2022 to every instance of the title function and I'm very happy That's not in menus anymore for a long time. So this plug-in was created in Terminal in less than two minutes On live talk and it would probably pass the review code At WordPress.org not because this is some magnificent function and I am great developer It's because it has everything you need to host a plug-in at WordPress at all You don't have to go and search don't very reinvent the wheel or Whatever it is that people do when just go and search and copy and paste, you know creating new project today I Hate starting new projects today because it takes so much time to set all the tools and everything and with WPC You don't have to do that. You can just run one command and start Writing your code. So help yourself and do that And now we've been talking for 37 minutes and didn't break anything That's outrageous We need to break this WordPress So I'm gonna do the little nightmare and just remove the semicolon sit Let's see what we have here Okay, so there has been a critical error really Not very helpful, right? But if this is a production you don't want anything else to be displayed But if this is production what you usually do is now you download everything to your local and then you try to recreate it and then you find it and fix it and then you Put it back probably to our testing environment to see if it's working and then you put it back to Production and it takes time and meanwhile your website is dead But with WPC li You know you can do like I can just type anything Any command but I will use team Team list because teams are loaded the last so I want to go through everything that is loading and Here you can see this error that is really not useful that is on front end But here is the PHP error, so I can see there is syntax error There is unexpected Bracket and expecting semicolon and it tells me so this is PHP error that you would get and you can see which line and what plugins so let me just fix that the line was What was it 18? Yeah, so this was unexpected and this was missing and Now we have working Website now in real world you will most likely not fix it that fast But in real world you will know what's the problem? You will be able to deactivate it plug-in or do whatever it needs to be done switch to another team wherever is the problem and you will be Having this website working while you can fix the error where you know it is and Now it's time for a little bit of magic go to my magic folder and I'm so It's empty completely. That's the magic And I'm gonna just say WP install Database name it's magic because everything is magic and password is My route Host I don't want to do anything here Site title magic, of course URL magic, you know, you guessed it and admin user and admin password and It's cooking So it asks us do you want to release the Kraken? Do we want of course we do? Hi Kraken and This is our Kraken. So this is the Just WordPress website that we have installed Obviously through a batch script and now I'm going to show you what's in that batch script It's in my bin It's called WordPress install so It's pretty simple It has only five commands WPC like commands. So first we download WordPress then we need to create config file and we need some credentials So what I'm doing here because it's my local it's always going to be the route for the user But for the password, I don't want my route password being saved in any file And I don't want my password to be saved in batch history So what I do is I just use a little bit of batch scripting, you know to hide input and I save this input into this Variable and then I'm collecting database name So I didn't have to do it because I have prompt, but I'm using this database name to build the admin email here because I don't want to type that for a local website and What I wanted you to see here is you can use prompt with just partial input So you can really you know Define what you know that will always be the same but what you don't know and maybe it will change the future you can just use prompt for everything else and then I just you know like to talk to myself through terminal and Then we install Core and again there are number of parameters. I don't want to type them ever again in my life So again, I'm just using batch scripting to collect all that info and now we have Revrite command and I want you to take a look at this So this is this first Website that we were working on and you see here there is index dot PHP in URL and I installed this WordPress with WPC live. However in this second one if we go to That we have built with Descript Here you know you see there is no Index dot PHP and this is because I used the rewrite command to change the Permalink structure now this doesn't work out of box like that What you need in config file is you need to enable mode rewrite module and then you can use all of rewrite Commands and what I'm doing here is just flashing rules and This is what Linux people do, you know, just add some fun thing You don't have to do that. It's this locomotive that we saw so it is actually a little program when you Make typo for listing directory a content you you write it Wrong and then you get The comedy and toilet is also for making your colorful letters in terminal and then So this is actually Script I use for my work because I don't install WordPress that often and when I do I like to just surprise myself And and have fun. Yeah, and then do you want to install release the Kraken if I want to I get Excal Saying hi and I open a dashboard or I have wonderful day If I don't want to release the Kraken now this doesn't have to be all this is pretty simple Just you know Default install if you have a set of plugins that you always use or you have specific theme that you always use Or some settings like different language or whatever you can put it all in here and Everything that you want to have you can put in here and at the end put that script for adding dummy content and just Flags, you know drink your coffee or tea whatever you like and you know, let it run you don't have to type any of that ever again and I hope that you saw Just how much potential it is in so this is really nothing this is If you try to if you go to documentation if you try to play with this You will see there are so many things you can do and we don't have enough time for that But I hope you saw the potential How you can make your work more efficient more secure You will have better code if you are developer and everything will be just faster and more fun And if doing things in terminal is not fun. I don't know what is really so My name is Milana top. I am WordPress engineer at XUP and one of the loudest members in Documentation to you. I'm also classical musician So if you have any questions if you want to discuss anything about WPC li or documentation or WordPress or classical music, you can you know find me there I had a lot of fun and thank you so much for your time