Resolving migration issues after renaming wp-content

I recently ran into a strange issue after performing a clone of a WordPress site using Infinite WordPress (my preferred WordPress management platform). The clone had worked great and I logged in and started to modify the new site. I quickly noticed something was wrong after WordPress admin panel started generating 404 errors. When I looked at the source code for the page it looked like I was still trying to load a number of CSS and JS files from the site I had cloned from. My first thought was that there was an issue with the clone and the old domain name was still being referenced in the database. I searched the database but everything seemed to be fine.

The Solution

Finally while looking for the cause of the problem I noticed that there were two lines at the top of my wp-config file that referenced the old domain name and old website install location. These two lines were added when I renamed the wp-content folder on the original site. I quickly updated the code to point to my new site and I was off an running. This is something to be aware of when using automated WordPress migration tools, they don’t always catch all references to the original site. I really like using the cloning functionality in Infinite WordPress and this doesn’t cause an issue as long as you are aware of the problem and include it in your work flow.

 More on Renaming wp-Content

If anyone is interested in renaming their wp-content folder either for security reasons or just so your site looks less like WordPress, take a look at the iThemes Security Plugin. The plugin will do it automatically for you along with allowing a ton of other security tweaks. Please make sure you back up your website before trying though!

 

For those who are interested the two lines I needed to change were something like this (where site-assets would be the new name for wp-content)

define( 'WP_CONTENT_URL', 'http://mennosites.ca/site-assets' );
define( 'WP_CONTENT_DIR', '/home/mennosites/public_html/site-assets' );

The best Genesis news site around (thedailybolt)

I recently stumbled on a Genesis news site (thedailybolt) that is quickly becoming a favourite place for me to keep updated on StudioPress/Genesis and WordPress in general. The site serves as an aggregator of articles posted on a variety of other websites. It simplifies the process of trying to keep up with the constant rush of news and information about Genesis by pulling all of the articles together and keeping them in one place.

You can visit the site here, and see what sites they pull articles from here.

If you work with Genesis or WordPress it’s definitely worth a look!

New website for Mennonite Trust Ltd.

We recently launched a brand new website for Mennonite Trust Ltd.

Since 1917 Mennonite Trust Ltd. has been in the business of providing financial and estate services from a Christian perspective. Formed as a joint partnership between Mennonite Church Saskatchewan, the Saskatchewan Conference of Mennonite Brethren Churches and the Fellowship of Evangelical Bible Churches, Mennonite Trust Ltd. is a truly Christian business with a genuine Christian perspective.

Mennonite Trust Ltd. has offices in Waldheim, Saskatoon, and Swift Current.
You can visit their new site here!

Help limit WordPress comment spam with your .htaccess file

Many spambots will visit wp-comments-post.php directly to comment on your WordPress site instead of actually going through a post. You can combat this type of spam by modify the .htaccess file of your WordPress site with the following code:

Example:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*mydomain.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]

Note: You will need to replace mydomain with your domain name with no prefix.

Example:

RewriteCond %{HTTP_REFERER} !.*mennosites.ca.* [OR]

How to include WordPress shortcodes outside of the Loop or in a Template

Shortcodes are a great way to quickly add many different types of functions within pages or posts on your WordPress site. Many plugins and WordPress itself include shortcodes to access their functionality. You can also create your own shortcodes by writing your own plugins or adding to your themes functions.php. Now there are occasions when it is handy to include shortcodes in WordPress page/post templates or within WordPress theme files. You can quickly add a shortcode into any php file with the following code:

echo do_shortcode("[shortcode]");

World Backup Day

For those of you who don’t know, today March 31st is World Backup Day. In our increasingly digitized world, keeping your data safe and secure both professionally and personally becomes increasingly important!

Today I received an email from Host Gator with the following stats:

  • All hard drives will crash during their lifetime
  • More than 1 in 10 laptops will be stolen in their lifetime
  • A laptop is stolen every 53 seconds
  • Every year 46% of computer users lose their music, photos, and documents
  • 50% of all hard drives will crash within 5 years
  • 89.1% of PC users don’t perform regular backups
  • A recent study from Gartner, Inc., found that 90 percent of companies that experience data loss go out of business within two years.
  • 70 percent of companies go out of business after a major data loss

If you are not regularly backing up your files please take the time to find and setup a backup solution. You can read a number of articles on how to backup your computer at WorldBackupDay.com.

Personally I use a mixture of Rsync and Rsnapshot to backup both my personal and business data. I love the amount of control I have over the backup process, and the fact that none of my data is stored in a proprietary format that locks me into one company or program.

If you aren’t backing up your website MennoSites.ca can help you setup an automatic, easy to use solution.

Modify WordPress AutoSave interval

WordPress automatically saves revisions to your posts and pages every 60 seconds. You are able to modify decrease the time interval if you’d like to reduce the chance of losing changes or increase it to cut down on the load to your database.

You can change the autosave frequency by adding the one of the following lines to the site’s wp-config.php file.

Examples:

/* Set AutoSave to 30 Seconds */
define ('AUTOSAVE_INTERVAL', 30); 
/* Set AutoSave to 5 Minutes */
define ('AUTOSAVE_INTERVAL', 300); 

GossenInsurance.ca is now BlocksAgencies.ca

Recently we launched a new website for Gossen Insurance. As of April 1st they have been bought by Block’s Agencies and will be operating under that name, along with two other agencies in Borden and Langham. We’ve re-branded the new Gossen Insurance website for Block’s Agencies, and added the two other locations that Block’s Agencies owns to the website as well. The website is now available through both blocksagencies.ca and blocksagencies.ca. This makes sure that any links to the old website, either sent out by email, printed on promotional material, or on Facebook will continue to work and will take the you to the right page. If you’d like to see how we set this up to make sure we didn’t confuse any visitors you can ready about it in our blog here.