Category Archives: WordPress

wordpress permalink

I finally got around to configuring Permalinks in WordPress! Some of you might laugh but based on my server configuration I had to do a little bit of research, configuring Permalinks in WordPress on a Parallels Plesk system requires a few minor modifications to the vhost which is hosting the WordPress Blog.

1) The first step is to check the directory of your vhost, you want to check for the .htaccess file:

ls -la /var/www/vhosts/<vhost-name>/conf

2) In my case the .htaccess file was not there, so I had to create it

touch /var/www/vhosts/<vhost-name>/conf/.htaccess

3) Make sure you change permissions on the file

chown root:apache /var/www/vhosts/<vhost-name>/conf/.htaccess

4) Edit the file accordingly, add the lines WordPress tells you to under “Settings –> Permalink.”

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

5) Now you need to reconfigure the individual vhost

/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=<vhost-name>

Or the new way Parallels Plesk requires you to do it (the above one works but you receive and warning: WARNING: You are using obsolete option, use corresponding option of httpdmng). See this post by Bryan White

 /usr/local/psa/admin/bin/httpdmng –reconfigure-domain skrakes.com

6) Test your WordPress Blog, the Permalink should now be working!

Posting Source Code in WordPress

Posting Source Code… in my WordPress Blog… So the other day I decided that it is time I spend some more time blogging and documenting the things I do on the computer, whether is be on Windows, MAC or Linux. With all the examples I am starting to post and want to post I figured it would be nice to show the example in its actual code syntax/format.

I started by signing up for the wordpress.org forums, great place. I obviously needed a plugin, extension or hack to get my “source code” to post properly in WordPress. I thought that maybe is was a quote thing but it turns out I was a little off. Click here to see my post in the wordpress forums.

Step 1) download the plugin

Step 2) read instructions on how to use the plugin

Step 3) post some code using the
[sourcecode language="css"]
your code here
[/sourcecode]

Thank you to the wonderful user listed in the above link I was able to install a plugin called “SyntaxHighlighter Evolved.” With a little bit of reading I was on my way, I can now post my source code to WordPress.

Plugin/Extension – SyntaxHighlighter Evolved

How to use SyntaxHighlighter Evolved

My appeal for help! (wordpress.org forums)

[ad#google-468×60]

Turn Off and Delete WordPress Post Revisions

So those post revisions WordPress is storing are starting to build up and you want to clean up… Maybe you want to turn off the post revisions… but you don’t know how, well read the following and you should be set. Please keep in mind I am NOT responsible for anything you might try on your own blog. These instructions are for WordPress 2.7.0, settings maybe changed in newer versions.

I used MySQL GUI tools to do the following however you can do it from the command line. I normally do it from the command line but sometimes GUI can just save time…

— CHECK THE AMMOUNT OF ROWS IN YOUR WP_POSTS TABLE
SELECT * FROM wp_posts WHERE post_type = “revision”;

— CREATE A BACKUP TABLE OF WP_POSTS (SHOULD DATE THE BAK TABLE YYYYMMMDD)
CREATE TABLE wp_posts_bak LIKE wp_posts;

— COPY THE ORIGINAL WP_POSTS INTO THE NEW BACKUP TABLE WP_POSTS_BAK (SHOULD DATE THE BAK TABLE YYYYMMMDD)
INSERT wp_posts_bak SELECT * FROM wp_posts;

— CONFIRM THE AMMOUNT OF ROWS IN WP_POSTS_BAK MATCH THE ROWS IN WP_POSTS
SELECT * FROM wp_posts_bak WHERE post_type = “revision”;

— DELETE THE DATA FROM WP_POSTS WHERE POST_TYPE=”REVISIONS”
DELETE FROM wp_posts WHERE post_type = “revision”;

— COMMIT YOUR DATABASE CHANGES (POINT OF NO RETURN – you can do a “ROLLBACK;” if your unsure)
COMMIT;

In order to stop WordPress from saving post revisions you will need to add the following line of code to the “wp-config.php” file. I recommend backing up the “wp-config.php” file before making any modifications. The method I am showing here assumes that you have shell/terminal or command line access. If you don’t have access to a shell/terminal or command line you can do it through an FTP program.

— BACKUP YOUR WORDPRESS CONFIG FILE BEFORE EDITING
cp -pr wp-config.php wp-config.php.ORIG (or by date wp-config.php_YYYYMMMDD)

— TURN OFF REVISIONS IN WORDPRESS IN wp-config.php by adding the following line
define(‘WP_POST_REVISIONS’, false);