About Travis Smith

As a WordPress Enthusiast, Travis writes about his journey in WordPress trying to help other WordPress travelers and enthusiasts with tutorials, explanations, & demonstrations of the things he learns.


Enabling & Installing Posts to Posts When a New Blog Is Created

The other day I came across an issue where Posts to Posts requires an administrator or someone with `manage_options` capability in order to install Posts to Posts table on a new blog creation. This does not work if all new sites create the default user as an Editor, and you need to immediately make Posts to Posts available for immediate use.

So here is the code that I used in order to make this possible.


Setting Up a Local Environment via XAMPP: Installing WordPress via Download

4. Download WordPress

Go to wordpress.org and download the latest build of WordPress. Go to the htdocs folder (where you installed the XAMPP), extract the wordpress.zip to a new folder (eg. mywordpress).

5. Run the Famous WordPress 5-minute Installation (install.php)

With your browser, go to http://localhost/mywordpress/wp-admin/install.php or http://localhost:8080/mywordpress/wp-admin/install.php, click Create a Configuration File and click Let’s go! Fill out Database Name (eg., wordpress), User Name (needs to be root), Password, Database Host, and Table Prefix (it is always a best practice to change the default wp_ prefix to something else). Be sure the User Name is the same as your mySQL username, “root”. Then click Run the Install, and follow the instructions to install WordPress. Fill in the Site Title, Username, Password twice, and email. Then click Install, and then Login.


Setting Up a Local Environment via XAMPP: Security

3. Setup XAMPP Security

Go back to localhost or localhost:8080 in your web browser. Click on security and it will open a new window/tab to http://localhost/security/index.php or http://localhost:8080/security/index.php.

Then click on the link: http://localhost/security/xamppsecurity.php. This will allow you to change your mySQL password and .htaccess password. Since this is typically my sandbox for breaking things and developing code, I just enter a mySQL password. Click password changing and you will receive a message: The root password was successfully changed. Please restart MYSQL for loading these changes! Then close the window/tab.


Setting Up a Local Environment via XAMPP: Error with Port 80 & Skype

If when you install it, port 80 is busy. This could be because of another program (like Skype) or your corporate network. So, if you have Skype installed, I recommend changing Skype’s default port. It simply makes everything easier.

Open Tools > Options
Skype Options

Click Advanced
Options Screen

Click on Connection
Advanced Settings

Uncheck “Use port 80 and 443 as alternatives for incoming connections”.
"Advanced Connection”/>
"Advanced Connection Remove port 80″/>

Click Save
Save Advanced Settings

Using a Different Port


Setting Up a Local Environment via XAMPP: Launching Apache & MySQL

Next we will launch Apache & MySQL. To do this easily, open the Control Panel.
XAMPP Control Panel

Click Start on both Apache and MySQL.
XAMPP Control Panel Start Apache
XAMPP Control Panel Apache Started

XAMPP Control Panel Start MySQL
XAMPP Control Panel MySQL Started

Now, if you want, you can install Apache and your local webserver to another port like 8080. To change the port, you want to navigate to your XAMPP directory (e.g., C:/xampp/apache/conf) and open the file httpd.conf in your text editor. On line 45, you’ll find:

To change it to port 8080, simply make this change:

Then later, on line 176, you’ll see:

ServerName localhost:80

Change it to:

ServerName localhost:8080

If you switch to port 8080, you’ll need to to always go to it via localhost:8080. Furthermore, WordPress will not allow you to enable multisite locally with a port number trailing localhost. It will redirect you to http://localhost/xampp/ or http://localhost:8080/xampp/.

You’re host directory will be C:/xampp/htdocs based on httpd.conf. If you wish to change it, simply find it in httpd.conf on line 183 and make whatever changes you’d like.


Setting Up a Local Environment via XAMPP: Configuring PHP

PHP comes installed with a preset configuration. In local environments, I tend to set things a lot higher than I normally would in a production site simply because it is for me and for strenuous testing, auditing, developing, debugging, etc.

So navigate to the C:\xampp\php\php.ini file and open within Notepad++.
Open php.ini

The file will look like this initially.

Go to line 451, and make the following changes:

This will allow you to do a bit more with the PHP instead of it timing out on you periodically.

And then on line 922, change upload_max_filesize to upload_max_filesize=100M
This will enable you to be able to upload large files to the WordPress Media area.

Then on line 1045, change the default timezone. For more information as to what value to place there, see http://php.net/date.timezone.
This obviously sets the server default timezone.

Now, there are other customizations you can make to the INI file, but these basic changes are all the essential ones.


Setting Up a Local Environment via XAMPP: Creating a Database via phpMyAdmin

4. Create a New Database

After you’ve installed XAMPP, run it by opening a browser and going to localhost, which will take you to the splash page.
XAMPP Splash

Click on your preferred language. It should take you to the start page, http://localhost/xampp/.

Now click on phpMyAdmin at the bottom left.
XAMPP phpMyAdmin

In the phpMyAdmin page, create a new database by clicking on Databases at the top.
XAMPP phpMyAdmin Databases

Since this is local anything will do (eg. prefix_wordpress). However, you want a more complicated database name than this to protect yourself from SQL injection on the internet. Adding a prefix will create folders to help with the organization.
XAMPP phpMyAdmin Create Database 1
XAMPP phpMyAdmin Create Database 2
XAMPP phpMyAdmin Result

Now go to phpMyAdmin, and create a new database (eg. prefix_wordpress) by typing in your database name (e.g. wordpress) and pressing CREATE.