Now that you have a local word installation let's mess with it.
We'll check out the file structure play with how WordPress connects to the database by changing the
URL.
Breaking the Web site and then fixing it again by editing the database tables.
You'll also learn where user information is stored in the database and change your user name directly
something that's not possible through WordPress itself.
In this video you'll learn several skills that can help you save a hacked or broken website and learn
to hack the database yourself to accomplish what you need.
Sweet whether you're working in a local development environment like map or local by flywheel or you're
using a live server like site ground.
Open and log into your Wordpress Web site and if you like activate the 2016 theme and let's explore
where themes and plug ins are located.
Appearance theme's is where we'll see the default theme 2016 active and a couple of other themes that
come with Wordpress and then if you click plugins installed plug ins you'll see that they're located
in a folder.
The two plugins that come with wordpress acus met to prevent comments spam and hello Dolly.
Let's play with Hello Dolly.
If your plug ins doesn't contain Hello Dolly yet you can just go up to add new and over on the right
side.
Search for the word hello or Hello Dolly and you'll find it and click Install now and activate activate
that plug in an original plug in by founder of wordpress.
Matt Mullen Wagh gives you a quote from the musical Hello Dolly at the top of your administration page.
We look at the file structure under map H.T. dox W.P..
Of course one where the plug ins and the themes are located.
Now it's important to know that you don't want to change any files under W.P. dash admin the dash includes
or any of the files in the core structure besides the config file.
But the WP Dasch content file is where all your content including uploads once you upload a file to
the media library it'll create an uploads folder here and the plug ins and themes are located in these
folders obviously.
And if you're using your site Ground live environment you can go back into the site Ground user area
and click go to see panel the control panel will give you access to that file manager that we used in
previous videos.
So inside the see panel I go down a little bit further to where I can see files and I'll click file
manager under W.P. content you can see that I have plug ins and themes and this time I have upgrade
and uploads as well.
Upgrade is created automatically by WordPress for updates of the software and uploads is created for
the media library but under plug ins.
There is my list of installed plugins.
Now if you end up with a plug in conflict where you have an active plug in or you activate one that
has a conflict that breaks your site.
An easy way to go in and rectify that situation is to go in via FCP.
If you're on a live web server or here using Windows Explorer you can go in and see which plugins are
here.
Here this one instead of being in a folder being a very simple plug in is just a single file.
If you go in and just rename a plugin file I'll just put Dasch rename after it.
When you go back and log in to your dashboard in wordpress go to the plugins page look at which plugins
I have have activated and it says the plug in Hello duppy HP has been deactivated.
The plugin file does not exist.
It's looking for a plug in from under a different file name and because I renamed it it deactivated
the plug in and then I can bring your website either back live or eliminate the plug in conflict.
If you are having one.
So now if I go back and into Windows Explorer I just go back and rename that plugin back to what it
was.
This is one way to troubleshoot conflicts with your web site as you're building it.
You can see that if I refresh the page here in the Wordpress dashboard that plugin is now d activated
and this is a good way to make your web site and your dashboard back active again.
If you were having a plugin conflict now navigate to settings general and let's look at the general
settings here we could see that one of the first couple of things we have is the title and the tag line
but the Wordpress address on the site address are the third and fourth fields in the general settings
panel.
And you could see that the URLs are the same.
But let's explore where these your L's are located within the database and find out how to change those
and why we would in the first place.
So if you navigate to the map start page again you can right click and open the PMI admin panel in a
new tab which I've already done up here.
And here we are in the database and I can click the W.P..
Of course one go ahead and browse into your own database using the name that you used when you set up
WordPress.
And if you're using the site Ground live site you can go down to the database sections in the see panel
and open Ph.
My admin.
It's the same exact utility that map uses and databases on the life site are located right here.
These are the tables that WordPress installs automatically and the L's are located in the underscore
options.
So if you click that once you can see all the tables located here
and the first two are the site you Arel and the home.
And in order to change these you can click once and click over here you can double click right here
and change that to what you want.
Now if the domain was pointed to something like W.P. of course one com hit enter and that will actually
change the row inside of the table.
In
the database doc.
Now if I change those two I can go back and if I just refresh the dashboard here you can see that the
server wasn't found.
Now of course I cannot access my website dashboard or the website itself through this domain name though
EPD of course one dot com unless I own that domain name and I have the domain pointed to the server
using it name servers or the DNS settings in my domain name registrar.
This is something you might run across as you migrate sites from either a staging environment into the
live development or live server environment at your hosting company or if you're moving sites that you're
building in one place under a testing you are l over to another live.
You are all on the server as well as if you're building a site and testing your L and then you point
the domain finally to the live your L instead of to a holding page or a coming soon page that you might
have open while you're building the web site.
Now if you can't navigate to the Web site or the dashboard because the DNS settings are already pointed
there or you're using the wrong you are here.
What happens if I try to go to localhost where I know the site is located local or slashed W.P. EPD
of course one slash W.P. Dasch admin.
If I navigate there there's a problem loading the page server's not found because it wants to redirect
to wherever the database tells it to redirect.
So on the server or in your home development environment your local development environment you can
navigate back to the database and let's make this the correct RL for the site you are in the home are
Eurail so that I can actually continue building the site.
If you remember that would be local host slash W.P..
Of course one
and then I'll do the same thing with the home Yoro.
And now I can be sure that if I want to go to local host be there of course one my web web site should
be back working again.
Yes.
Here it is.
And I'm still locked in.
So I could actually go to the dashboard and continue working on the site.
So give that a try yourself.
Break the website and then fix it again by editing the site you are l and the home your URL in the database.
OK.
Hopefully you have broken the Web site and then fixed it again by editing some rows inside of your database.
Now let's take a look at some more of the file structure under themes and I'm going to navigate to the
content and themes this time.
I know that my theme that I have active is 2016.
Let's go ahead and just verify that here it is 20:16 is the active theme.
So I'm going to open 2016 and just take a look at the files in here.
And one of the main files that performs layout functions and defines how the content is displayed in
wordpress is called the functions dot ph P file.
Sometimes this will be a file that you might make changes on to customize a web site but there's a best
practices in terms of how to edit this file and where to edit it.
Let's take a look inside WordPress by default the Wordpress dashboard comes with under the appearance
panel an editor.
Now the first time you visit the editor it will give you a heads up message that says You appear to
be making direct edits to your theme in the Wordpress dashboard.
It's not necessarily best practice.
And in fact we'll learn later in the course how to make child themes so the one we want to add code
to the theme files will do it without editing the theme itself.
It's a parent theme and a child theme relationship but you can go ahead and make direct edits anyway
and you just have to click.
I understand one particular file that might be the file most often edited in wordpress themes is the
style dot CSSA file.
And there's another message that you can see here that says there's no need to change your CSSA or your
cascading style sheets file.
You can edit and live preview CSSA changes in the built in CSSA editor that's located under appearance
in the customized there is no automatic editor or previewer like there is for CSSA for the functions
that the HP file.
That's a place where you'd want to use a child theme.
In most cases but I just wanted to show you if we go down to the bottom of this file say we were doing
a little editing anyway even though it's not a best practice in the themes functions that BHP file.
But if I deleted the last semi-colon here and then went and tried to save the file.
WordPress has a syntax checker.
It will check to make sure that there's no errors.
So your site doesn't break and give you the white screen of death as it's so-called.
In this case in my local environment it tells me that it's unable to communicate back with the site
to check for fatal errors.
And so the change was reverted.
It won't let me break the site through the Wordpress dashboard in an example I'll show in one of my
live sites at site ground.
I did the same kind of thing I deleted the last semi-colon.
This one was able to communicate and it said that the HP code changes were rolled back due to an error
on line 6 16.
It's expecting a semicolon.
So if you make an error it will either tell you that it can't communicate or it'll tell you what the
error is and it won't let you break your own site.
One more thing.
Let's go ahead and look at user accounts.
You should probably be the only user within your account in wordpress and you can see your Wordpress
e-mail there your role as administrator.
Now if I click on my name here or at it I can open my profile and suppose I wanted to change my user
name.
Perhaps you're editing someone else's WordPress installation that's older and is using the traditional
admin as a user name which is best practice not to use because it's too recognizable for hackers.
But if you wanted to change the user name it says here usernames cannot be changed.
Well let's go ahead and change the user name using the database so navigate back to the database or
go back there if you already have it open.
Let's look at our WordPress tables again and let's see under W.P. users I can see that there's a user
here user log in is where the user name is located.
Now if I just double click that row I could change that to a different username.
What if I just add my middle initial and hit enter.
Now what's going to happen over here if I refresh the page on my profile.
Oh it's logged me out because there is no more.
Greg Davis as a user inside the system the user name is changed and it has the same password.
So I wonder if I can log in using the same username and password except I've added an s my middle initial.
Great let's look at my profile my user name is now changed.
So if you need to change the user name from admin to something different or do that you don't have to
necessarily create a new user and then delete the old user.
You can go into the database and edit that username.
One last useful edit that we can learn using the database is to update someone's password if they can't
use the last year password link when someone clicks this link.
The system should email them a reset password link to the administrator e-mail.
But if you're using man especially earlier versions of map they don't actually send e-mail out in the
server system.
If you need to you can always log into the database using ph be my admin or another database error editor
and you can edit the password of a user but there's a particular way that you want to do that.
You can see that the user underscore pass under the WP users table and the row for a user is a string.
That's not the actual password.
It is encrypted.
Even inside the database However this can be edited this time instead of double clicking it like that.
I'm going to click edit so that I can look at all the rows for this field inside of the table.
Now the user pass is what I'm going to edit.
So if I just create a password which is
not a very good one Greg's password with a capital G and I hit go to save this.
That's actually not going to work.
I want to make sure that this password is encrypted in a certain way.
So under the function dropdown here for this new password I need to select M.D 5 that is the type of
encryption that WordPress uses for passwords.
So I'm looking for here it is it's near the top.
M.D 5 is what you have to have selected to choose a new password for a user.
Now go down in ph PMI admin and click go.
And it said that one row was changed.
You can see that the user pass element is now a different encrypted password.
But you have to remember what that password is.
So if I go back my username is the same but if I type
that password and log in.
Now I have a new password for that user.
In this lesson you've broken your website in three different ways and then fixed it by editing a plug
in file the database and the themes functions Doppie H-P file.
Great job.
In the next video we'll go over your student sandbox at W.P. of course dot com in detail and get it
ready for you to experiment with premium themes and frameworks and premium plugins.
See there.