﻿1
00:00:00,750 --> 00:00:04,610
Now that you have a local word installation let's mess with it.

2
00:00:04,670 --> 00:00:09,170
We'll check out the file structure play with how WordPress connects to the database by changing the

3
00:00:09,260 --> 00:00:09,910
URL.

4
00:00:10,070 --> 00:00:14,710
Breaking the Web site and then fixing it again by editing the database tables.

5
00:00:14,750 --> 00:00:19,820
You'll also learn where user information is stored in the database and change your user name directly

6
00:00:20,060 --> 00:00:22,870
something that's not possible through WordPress itself.

7
00:00:23,180 --> 00:00:28,790
In this video you'll learn several skills that can help you save a hacked or broken website and learn

8
00:00:28,790 --> 00:00:31,810
to hack the database yourself to accomplish what you need.

9
00:00:31,860 --> 00:00:38,990
Sweet whether you're working in a local development environment like map or local by flywheel or you're

10
00:00:38,990 --> 00:00:41,320
using a live server like site ground.

11
00:00:41,510 --> 00:00:50,250
Open and log into your Wordpress Web site and if you like activate the 2016 theme and let's explore

12
00:00:50,250 --> 00:00:53,540
where themes and plug ins are located.

13
00:00:53,580 --> 00:01:01,530
Appearance theme's is where we'll see the default theme 2016 active and a couple of other themes that

14
00:01:01,530 --> 00:01:09,810
come with Wordpress and then if you click plugins installed plug ins you'll see that they're located

15
00:01:11,010 --> 00:01:11,690
in a folder.

16
00:01:11,700 --> 00:01:18,010
The two plugins that come with wordpress acus met to prevent comments spam and hello Dolly.

17
00:01:18,060 --> 00:01:20,720
Let's play with Hello Dolly.

18
00:01:20,790 --> 00:01:27,690
If your plug ins doesn't contain Hello Dolly yet you can just go up to add new and over on the right

19
00:01:27,690 --> 00:01:28,410
side.

20
00:01:28,530 --> 00:01:39,150
Search for the word hello or Hello Dolly and you'll find it and click Install now and activate activate

21
00:01:39,150 --> 00:01:44,190
that plug in an original plug in by founder of wordpress.

22
00:01:44,180 --> 00:01:52,660
Matt Mullen Wagh gives you a quote from the musical Hello Dolly at the top of your administration page.

23
00:01:52,830 --> 00:01:56,980
We look at the file structure under map H.T. dox W.P..

24
00:01:57,060 --> 00:02:01,140
Of course one where the plug ins and the themes are located.

25
00:02:01,260 --> 00:02:09,690
Now it's important to know that you don't want to change any files under W.P. dash admin the dash includes

26
00:02:09,990 --> 00:02:14,250
or any of the files in the core structure besides the config file.

27
00:02:14,580 --> 00:02:22,950
But the WP Dasch content file is where all your content including uploads once you upload a file to

28
00:02:22,950 --> 00:02:29,580
the media library it'll create an uploads folder here and the plug ins and themes are located in these

29
00:02:29,670 --> 00:02:31,250
folders obviously.

30
00:02:31,640 --> 00:02:36,870
And if you're using your site Ground live environment you can go back into the site Ground user area

31
00:02:37,200 --> 00:02:43,860
and click go to see panel the control panel will give you access to that file manager that we used in

32
00:02:43,860 --> 00:02:45,530
previous videos.

33
00:02:45,600 --> 00:02:51,780
So inside the see panel I go down a little bit further to where I can see files and I'll click file

34
00:02:51,780 --> 00:02:59,840
manager under W.P. content you can see that I have plug ins and themes and this time I have upgrade

35
00:02:59,840 --> 00:03:01,670
and uploads as well.

36
00:03:01,670 --> 00:03:07,940
Upgrade is created automatically by WordPress for updates of the software and uploads is created for

37
00:03:07,940 --> 00:03:11,150
the media library but under plug ins.

38
00:03:11,270 --> 00:03:14,230
There is my list of installed plugins.

39
00:03:14,300 --> 00:03:19,340
Now if you end up with a plug in conflict where you have an active plug in or you activate one that

40
00:03:19,340 --> 00:03:21,820
has a conflict that breaks your site.

41
00:03:21,860 --> 00:03:27,800
An easy way to go in and rectify that situation is to go in via FCP.

42
00:03:27,860 --> 00:03:34,880
If you're on a live web server or here using Windows Explorer you can go in and see which plugins are

43
00:03:34,880 --> 00:03:35,610
here.

44
00:03:35,630 --> 00:03:41,370
Here this one instead of being in a folder being a very simple plug in is just a single file.

45
00:03:41,420 --> 00:03:49,530
If you go in and just rename a plugin file I'll just put Dasch rename after it.

46
00:03:49,820 --> 00:03:57,890
When you go back and log in to your dashboard in wordpress go to the plugins page look at which plugins

47
00:03:57,890 --> 00:04:02,920
I have have activated and it says the plug in Hello duppy HP has been deactivated.

48
00:04:03,020 --> 00:04:04,710
The plugin file does not exist.

49
00:04:04,710 --> 00:04:12,170
It's looking for a plug in from under a different file name and because I renamed it it deactivated

50
00:04:12,170 --> 00:04:18,400
the plug in and then I can bring your website either back live or eliminate the plug in conflict.

51
00:04:18,530 --> 00:04:20,560
If you are having one.

52
00:04:20,900 --> 00:04:28,160
So now if I go back and into Windows Explorer I just go back and rename that plugin back to what it

53
00:04:28,160 --> 00:04:29,110
was.

54
00:04:31,260 --> 00:04:36,770
This is one way to troubleshoot conflicts with your web site as you're building it.

55
00:04:36,780 --> 00:04:44,010
You can see that if I refresh the page here in the Wordpress dashboard that plugin is now d activated

56
00:04:45,000 --> 00:04:49,440
and this is a good way to make your web site and your dashboard back active again.

57
00:04:49,440 --> 00:04:59,430
If you were having a plugin conflict now navigate to settings general and let's look at the general

58
00:04:59,430 --> 00:05:04,460
settings here we could see that one of the first couple of things we have is the title and the tag line

59
00:05:04,770 --> 00:05:11,760
but the Wordpress address on the site address are the third and fourth fields in the general settings

60
00:05:11,760 --> 00:05:12,600
panel.

61
00:05:12,600 --> 00:05:15,900
And you could see that the URLs are the same.

62
00:05:15,900 --> 00:05:23,190
But let's explore where these your L's are located within the database and find out how to change those

63
00:05:23,310 --> 00:05:25,300
and why we would in the first place.

64
00:05:26,460 --> 00:05:33,830
So if you navigate to the map start page again you can right click and open the PMI admin panel in a

65
00:05:33,850 --> 00:05:36,540
new tab which I've already done up here.

66
00:05:36,820 --> 00:05:40,840
And here we are in the database and I can click the W.P..

67
00:05:40,840 --> 00:05:47,320
Of course one go ahead and browse into your own database using the name that you used when you set up

68
00:05:47,320 --> 00:05:48,210
WordPress.

69
00:05:48,730 --> 00:05:55,090
And if you're using the site Ground live site you can go down to the database sections in the see panel

70
00:05:55,540 --> 00:05:56,830
and open Ph.

71
00:05:56,890 --> 00:05:57,900
My admin.

72
00:05:58,000 --> 00:06:04,740
It's the same exact utility that map uses and databases on the life site are located right here.

73
00:06:04,750 --> 00:06:12,220
These are the tables that WordPress installs automatically and the L's are located in the underscore

74
00:06:12,310 --> 00:06:13,890
options.

75
00:06:13,930 --> 00:06:18,130
So if you click that once you can see all the tables located here

76
00:06:21,160 --> 00:06:26,620
and the first two are the site you Arel and the home.

77
00:06:27,220 --> 00:06:34,210
And in order to change these you can click once and click over here you can double click right here

78
00:06:34,240 --> 00:06:37,920
and change that to what you want.

79
00:06:37,990 --> 00:06:50,910
Now if the domain was pointed to something like W.P. of course one com hit enter and that will actually

80
00:06:50,910 --> 00:06:55,010
change the row inside of the table.

81
00:06:56,300 --> 00:06:56,720
In

82
00:06:59,730 --> 00:07:05,460
the database doc.

83
00:07:06,480 --> 00:07:16,050
Now if I change those two I can go back and if I just refresh the dashboard here you can see that the

84
00:07:16,050 --> 00:07:18,320
server wasn't found.

85
00:07:18,330 --> 00:07:26,080
Now of course I cannot access my website dashboard or the website itself through this domain name though

86
00:07:26,090 --> 00:07:32,550
EPD of course one dot com unless I own that domain name and I have the domain pointed to the server

87
00:07:33,060 --> 00:07:39,490
using it name servers or the DNS settings in my domain name registrar.

88
00:07:39,490 --> 00:07:44,580
This is something you might run across as you migrate sites from either a staging environment into the

89
00:07:44,580 --> 00:07:51,570
live development or live server environment at your hosting company or if you're moving sites that you're

90
00:07:51,570 --> 00:07:57,890
building in one place under a testing you are l over to another live.

91
00:07:57,960 --> 00:08:05,040
You are all on the server as well as if you're building a site and testing your L and then you point

92
00:08:05,040 --> 00:08:12,030
the domain finally to the live your L instead of to a holding page or a coming soon page that you might

93
00:08:12,030 --> 00:08:14,680
have open while you're building the web site.

94
00:08:15,030 --> 00:08:21,210
Now if you can't navigate to the Web site or the dashboard because the DNS settings are already pointed

95
00:08:21,210 --> 00:08:24,550
there or you're using the wrong you are here.

96
00:08:24,750 --> 00:08:32,780
What happens if I try to go to localhost where I know the site is located local or slashed W.P. EPD

97
00:08:32,790 --> 00:08:38,330
of course one slash W.P. Dasch admin.

98
00:08:39,000 --> 00:08:44,790
If I navigate there there's a problem loading the page server's not found because it wants to redirect

99
00:08:45,120 --> 00:08:48,280
to wherever the database tells it to redirect.

100
00:08:48,930 --> 00:08:53,910
So on the server or in your home development environment your local development environment you can

101
00:08:53,910 --> 00:09:01,350
navigate back to the database and let's make this the correct RL for the site you are in the home are

102
00:09:01,350 --> 00:09:04,870
Eurail so that I can actually continue building the site.

103
00:09:05,190 --> 00:09:10,120
If you remember that would be local host slash W.P..

104
00:09:10,290 --> 00:09:11,430
Of course one

105
00:09:15,650 --> 00:09:27,110
and then I'll do the same thing with the home Yoro.

106
00:09:27,410 --> 00:09:38,610
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

107
00:09:38,610 --> 00:09:39,750
be back working again.

108
00:09:39,750 --> 00:09:40,290
Yes.

109
00:09:40,290 --> 00:09:41,090
Here it is.

110
00:09:41,220 --> 00:09:43,350
And I'm still locked in.

111
00:09:43,650 --> 00:09:53,630
So I could actually go to the dashboard and continue working on the site.

112
00:09:53,700 --> 00:09:55,320
So give that a try yourself.

113
00:09:55,440 --> 00:10:03,260
Break the website and then fix it again by editing the site you are l and the home your URL in the database.

114
00:10:06,400 --> 00:10:06,910
OK.

115
00:10:06,920 --> 00:10:16,310
Hopefully you have broken the Web site and then fixed it again by editing some rows inside of your database.

116
00:10:17,520 --> 00:10:24,710
Now let's take a look at some more of the file structure under themes and I'm going to navigate to the

117
00:10:24,750 --> 00:10:27,790
content and themes this time.

118
00:10:28,440 --> 00:10:32,490
I know that my theme that I have active is 2016.

119
00:10:32,940 --> 00:10:40,760
Let's go ahead and just verify that here it is 20:16 is the active theme.

120
00:10:41,060 --> 00:10:45,550
So I'm going to open 2016 and just take a look at the files in here.

121
00:10:45,710 --> 00:10:54,470
And one of the main files that performs layout functions and defines how the content is displayed in

122
00:10:54,470 --> 00:11:00,440
wordpress is called the functions dot ph P file.

123
00:11:00,490 --> 00:11:07,330
Sometimes this will be a file that you might make changes on to customize a web site but there's a best

124
00:11:07,330 --> 00:11:12,950
practices in terms of how to edit this file and where to edit it.

125
00:11:13,240 --> 00:11:21,640
Let's take a look inside WordPress by default the Wordpress dashboard comes with under the appearance

126
00:11:21,640 --> 00:11:24,880
panel an editor.

127
00:11:24,880 --> 00:11:29,860
Now the first time you visit the editor it will give you a heads up message that says You appear to

128
00:11:29,860 --> 00:11:34,010
be making direct edits to your theme in the Wordpress dashboard.

129
00:11:34,150 --> 00:11:36,580
It's not necessarily best practice.

130
00:11:36,610 --> 00:11:42,820
And in fact we'll learn later in the course how to make child themes so the one we want to add code

131
00:11:43,000 --> 00:11:48,580
to the theme files will do it without editing the theme itself.

132
00:11:48,650 --> 00:11:55,330
It's a parent theme and a child theme relationship but you can go ahead and make direct edits anyway

133
00:11:55,380 --> 00:11:56,550
and you just have to click.

134
00:11:56,590 --> 00:12:03,850
I understand one particular file that might be the file most often edited in wordpress themes is the

135
00:12:03,850 --> 00:12:06,160
style dot CSSA file.

136
00:12:06,360 --> 00:12:11,770
And there's another message that you can see here that says there's no need to change your CSSA or your

137
00:12:11,920 --> 00:12:13,800
cascading style sheets file.

138
00:12:13,810 --> 00:12:20,800
You can edit and live preview CSSA changes in the built in CSSA editor that's located under appearance

139
00:12:21,190 --> 00:12:30,310
in the customized there is no automatic editor or previewer like there is for CSSA for the functions

140
00:12:30,320 --> 00:12:32,310
that the HP file.

141
00:12:32,320 --> 00:12:34,720
That's a place where you'd want to use a child theme.

142
00:12:34,720 --> 00:12:41,200
In most cases but I just wanted to show you if we go down to the bottom of this file say we were doing

143
00:12:41,200 --> 00:12:47,340
a little editing anyway even though it's not a best practice in the themes functions that BHP file.

144
00:12:47,410 --> 00:12:53,870
But if I deleted the last semi-colon here and then went and tried to save the file.

145
00:12:53,960 --> 00:12:56,390
WordPress has a syntax checker.

146
00:12:56,460 --> 00:12:58,630
It will check to make sure that there's no errors.

147
00:12:58,630 --> 00:13:04,010
So your site doesn't break and give you the white screen of death as it's so-called.

148
00:13:04,240 --> 00:13:09,520
In this case in my local environment it tells me that it's unable to communicate back with the site

149
00:13:09,520 --> 00:13:11,330
to check for fatal errors.

150
00:13:11,470 --> 00:13:13,610
And so the change was reverted.

151
00:13:13,630 --> 00:13:19,960
It won't let me break the site through the Wordpress dashboard in an example I'll show in one of my

152
00:13:19,960 --> 00:13:21,960
live sites at site ground.

153
00:13:21,970 --> 00:13:25,860
I did the same kind of thing I deleted the last semi-colon.

154
00:13:25,900 --> 00:13:31,600
This one was able to communicate and it said that the HP code changes were rolled back due to an error

155
00:13:31,600 --> 00:13:34,140
on line 6 16.

156
00:13:34,360 --> 00:13:37,250
It's expecting a semicolon.

157
00:13:37,270 --> 00:13:41,980
So if you make an error it will either tell you that it can't communicate or it'll tell you what the

158
00:13:41,980 --> 00:13:46,450
error is and it won't let you break your own site.

159
00:13:46,900 --> 00:13:47,890
One more thing.

160
00:13:48,130 --> 00:13:50,970
Let's go ahead and look at user accounts.

161
00:13:52,030 --> 00:13:58,660
You should probably be the only user within your account in wordpress and you can see your Wordpress

162
00:13:58,690 --> 00:14:01,680
e-mail there your role as administrator.

163
00:14:01,690 --> 00:14:08,580
Now if I click on my name here or at it I can open my profile and suppose I wanted to change my user

164
00:14:08,590 --> 00:14:09,390
name.

165
00:14:09,470 --> 00:14:15,550
Perhaps you're editing someone else's WordPress installation that's older and is using the traditional

166
00:14:15,790 --> 00:14:22,740
admin as a user name which is best practice not to use because it's too recognizable for hackers.

167
00:14:22,990 --> 00:14:27,850
But if you wanted to change the user name it says here usernames cannot be changed.

168
00:14:28,150 --> 00:14:34,030
Well let's go ahead and change the user name using the database so navigate back to the database or

169
00:14:34,210 --> 00:14:36,230
go back there if you already have it open.

170
00:14:36,250 --> 00:14:46,210
Let's look at our WordPress tables again and let's see under W.P. users I can see that there's a user

171
00:14:46,210 --> 00:14:52,240
here user log in is where the user name is located.

172
00:14:52,240 --> 00:15:00,570
Now if I just double click that row I could change that to a different username.

173
00:15:00,610 --> 00:15:05,820
What if I just add my middle initial and hit enter.

174
00:15:05,890 --> 00:15:10,640
Now what's going to happen over here if I refresh the page on my profile.

175
00:15:10,920 --> 00:15:13,690
Oh it's logged me out because there is no more.

176
00:15:13,690 --> 00:15:20,440
Greg Davis as a user inside the system the user name is changed and it has the same password.

177
00:15:20,500 --> 00:15:32,140
So I wonder if I can log in using the same username and password except I've added an s my middle initial.

178
00:15:32,140 --> 00:15:38,730
Great let's look at my profile my user name is now changed.

179
00:15:38,750 --> 00:15:44,090
So if you need to change the user name from admin to something different or do that you don't have to

180
00:15:44,090 --> 00:15:48,410
necessarily create a new user and then delete the old user.

181
00:15:48,470 --> 00:15:53,440
You can go into the database and edit that username.

182
00:15:53,480 --> 00:16:00,110
One last useful edit that we can learn using the database is to update someone's password if they can't

183
00:16:00,110 --> 00:16:04,610
use the last year password link when someone clicks this link.

184
00:16:04,610 --> 00:16:10,650
The system should email them a reset password link to the administrator e-mail.

185
00:16:10,880 --> 00:16:18,170
But if you're using man especially earlier versions of map they don't actually send e-mail out in the

186
00:16:18,170 --> 00:16:19,550
server system.

187
00:16:19,550 --> 00:16:26,180
If you need to you can always log into the database using ph be my admin or another database error editor

188
00:16:26,570 --> 00:16:32,430
and you can edit the password of a user but there's a particular way that you want to do that.

189
00:16:32,450 --> 00:16:41,510
You can see that the user underscore pass under the WP users table and the row for a user is a string.

190
00:16:41,540 --> 00:16:43,310
That's not the actual password.

191
00:16:43,310 --> 00:16:44,870
It is encrypted.

192
00:16:44,870 --> 00:16:53,620
Even inside the database However this can be edited this time instead of double clicking it like that.

193
00:16:53,630 --> 00:17:00,680
I'm going to click edit so that I can look at all the rows for this field inside of the table.

194
00:17:00,860 --> 00:17:04,060
Now the user pass is what I'm going to edit.

195
00:17:04,250 --> 00:17:08,120
So if I just create a password which is

196
00:17:10,760 --> 00:17:16,920
not a very good one Greg's password with a capital G and I hit go to save this.

197
00:17:17,030 --> 00:17:18,300
That's actually not going to work.

198
00:17:18,320 --> 00:17:23,760
I want to make sure that this password is encrypted in a certain way.

199
00:17:23,840 --> 00:17:33,620
So under the function dropdown here for this new password I need to select M.D 5 that is the type of

200
00:17:33,620 --> 00:17:37,850
encryption that WordPress uses for passwords.

201
00:17:37,910 --> 00:17:41,750
So I'm looking for here it is it's near the top.

202
00:17:41,750 --> 00:17:47,570
M.D 5 is what you have to have selected to choose a new password for a user.

203
00:17:47,570 --> 00:17:51,330
Now go down in ph PMI admin and click go.

204
00:17:51,590 --> 00:17:53,870
And it said that one row was changed.

205
00:17:53,870 --> 00:17:58,510
You can see that the user pass element is now a different encrypted password.

206
00:17:58,700 --> 00:18:00,860
But you have to remember what that password is.

207
00:18:00,860 --> 00:18:04,760
So if I go back my username is the same but if I type

208
00:18:07,640 --> 00:18:10,220
that password and log in.

209
00:18:10,220 --> 00:18:13,590
Now I have a new password for that user.

210
00:18:15,040 --> 00:18:20,080
In this lesson you've broken your website in three different ways and then fixed it by editing a plug

211
00:18:20,080 --> 00:18:24,990
in file the database and the themes functions Doppie H-P file.

212
00:18:25,000 --> 00:18:26,640
Great job.

213
00:18:26,810 --> 00:18:34,120
In the next video we'll go over your student sandbox at W.P. of course dot com in detail and get it

214
00:18:34,120 --> 00:18:39,530
ready for you to experiment with premium themes and frameworks and premium plugins.

215
00:18:39,550 --> 00:18:40,060
See there.

