Category Archives: WordPress

Upgrading to WordPress 6.1

1
Filed under Blogging, WordPress

This site’s been chugging along for years now. I’ve been super happy with my hosting company, NameCheap, and everything has just worked.

Until, of course, it didn’t.

I used to use Microsoft’s LiveWriter way back when, but then, they quit updating it and it quit connecting to my blog so… I just used the WordPress editor and continued on.

I finally had minute to take a look and realized that I hadn’t updated WordPress is quite some time.

So, back up the site, then update… oops, no, I’m using an ancient version of PHP.

So, update PHP to 8.1

Update WP to 6.1

Bam!

Critical error loading WordPress

Oh Joy

So I start all the typical stuff. I’m no WordPress expert, by any stretch.

Update all the plugins.

Nope

Disable all the plugins.

Nope

Clear caches. Reset Themes.

Nope, and Nope.

This might turn into a long night.

So I punt.

The guys (and gals) in NameCheap support have pulled me out of a wringer before, so I figured I might give em a shout. The worst they could do is tell me “that’s your programming problem”. Smile

Joy

So I search the Knowledge Base right quick, come up empty, and finally decide to file a support ticket.

Within an hour, I get a message back that they’d had a look at my WordPress log and the issue appeared to be with my theme at line x.

No freakin’ way!

Open the theme INDEX.PHP up and, sure enough, turns out the old WordPress was more forgiving with PHP files that used <? … ?> instead of the newer style <?PHP … ?>

Literally 2 lines of code changed and presto. Entire site back and running!

And not only that, the latest OpenLiveWriter (the open sourced version of my old friend), recognized it and loaded up perfectly. I’m even writing up this entry using it!

Just Upgraded to SyntaxHighlighter 3.0.83

0
Filed under Blogging, WordPress

I had to use the shLegacy.js option since I’ve got tons of <PRE> tags all over this site using the older version. Not great bbecause the “Autoload” function for syntax brushes doesn’t seem to work in conjunction with shLegacy.js, but I suppose that’s to be expected.

If you notice any “unhighlighted” code, just let me know.

WordPress 3.2.1 and Comment Notification

0
Filed under WordPress

One of the nice features of WordPress is it’s extensive notification options. It’s nice to get an email notifying me when someone has commented on a particular post.

However, something doesn’t seem quite right with the feature.

In the admin screen, under Settings-Discussions, you’ll see these options.

image

Notice the highlighted option. The idea here is that for a comment to be considered “Legitimate”, it’s author should have at least 1 previously approved comment. Otherwise, you could potentially have a ton of spam get posted "and visible until I notice it and remove it.

Unfortunately, this option doesn’t appear to work quite right in conjunction with notifications.

If the option is unchecked, things seem to be ok, the comment is posted and readable right from the first, AND I get a notification email.

However, if the option is checked, and the comment author doesn’t already have an approved comment, the comment is posted for moderation but not visible (which is correct), but I never receive a notification email of the comment. This is bad because I’ll never know to approve the comment, so no comments that the author posts will be visible until I explicitly go to my site admin pages and check for comments.

So far, I’ve been unable to find any info about this, but I can repeatable reproduce the behavior.

URL Rewriting with WordPress

0
Filed under Troubleshooting, WordPress

imageI moved this blog from dasBlog to WordPress back around the middle of 2010. At the time, I had gotten pretty permalinks operational just fine. If you don’t know what pretty permalinks are, they’re essentially alternate URLs for the pages of a blog, that are nice and human readable, like www.vbfengshui.com/contact-me instead of www.vbfengshui.com?page=564.

However, just in the last few days, I noticed they weren’t working anymore.

What happened?

Unfortunately, this is one of those situations, where, as a developer and not a web admin, I don’t do this sort of thing often enough to really remember what I do to get things operational. Ask me about multithreading in MSSQL, or how to make the best use of an anonymous delegate in .net, no problem. But configuring WordPress!?! <g>

The problem was, any time I’d try navigating to a pretty URL (say www.vbfengshui.com/contact-me), I’d end up at a page saying

“the system cannot find the file specified”

Not much help.

Googling that error turned up a number of posts, most of which indicates that either .htaccess didn’t have the proper permissions, or that, under IIS, the URL Rewrite module wasn’t installed.

Unfortunately, I’m running hosted IIS, and my host doesn’t provide access to installing things like URL Rewrite.

So what had happened?

After more Googling, I came across this post on the ikailo.com site. The hint (or the reminder as the case may be) I needed was this comment in their 404-handler.php script:

The name of this file.
// Set this value for the URL in Custom Error Properties of your website in IIS.
// Goto: IIS Manager > Websites > [Site Name] > Properties > Custom Errors >
Aha! My host DOES allow me to edit custom 404 handlers, and checking that, I’d already configured it to /wp-404-handler.php. Hmm. Why wasn’t that working? I loaded up FileZilla and started looking around. Lo and behold, that file was no longer there!
Fortunately, the ikailo.com site provides a great little 404 handler script that works just fine with WP 3.2.1. I’m including it here:
<?php
// This is the default file for the site. Usually index.php
$default = 'index.php';
 
// The name of this file.
// Set this value for the URL in Custom Error Properties of your website in IIS.
// Goto: IIS Manager > Websites > [Site Name] > Properties > Custom Errors >
// 404 & 404;2 & 404;3 > URL (Requires a '/' prefix in IIS).
$thisfile = '404-handler.php';
 
$_SERVER['ORIG_PATH_TRANSLATED'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_TRANSLATED']);
$_SERVER['SCRIPT_FILENAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_FILENAME']);
$_SERVER['ORIG_PATH_INFO'] = str_replace($thisfile, $default, $_SERVER['ORIG_PATH_INFO']);
$_SERVER['SCRIPT_NAME'] = str_replace($thisfile, $default, $_SERVER['SCRIPT_NAME']);
$_SERVER['PHP_SELF'] = str_replace($thisfile, $default, $_SERVER['PHP_SELF']);
$_SERVER['PATH_INFO'] = false;
 
$qs =& $_SERVER['QUERY_STRING'];
$ru =& $_SERVER['REQUEST_URI'];
$pos = strrpos($qs, '://');
$pos = strpos($qs, '/', $pos + 4);
$_SERVER['URL'] = $ru = substr($qs, $pos);
$qs = trim(stristr($ru, '?'), '?');
 
// Required for WordPress 2.8+
$_SERVER['HTTP_X_ORIGINAL_URL'] = $ru;
 
// Fix GET vars
foreach ( $_GET as $var => $val ) {
  if ( substr($var, 0, 3) == '404') {
    if ( strstr($var, '?') ) {
      $newvar = substr($var, strpos($var, '?') + 1);
      $_GET[$newvar] = $val;
    }
    unset($_GET[$var]);
  }
  break;
}
include($default);
?>

Just follow the directions at the top of the file and you should be good to go with nice URLs, even under IIS without the Rewrite module.

I’m guessing that an upgrade of WP at some point removed the old WP-404-Handler.php file. This one, I’ve saved as just 404-handler.php. No idea whether that’ll help to preserve it through the next upgrade but we’ll see.

ShiftThisSwift SMTP Configuration for WordPress

0
Filed under Blogging, WordPress

I’m in the throes of conversion from dasBlog (a great ASP.net based blogging engine, btw) to WordPress, as you can no doubt tell from the sometimes random gobbledygook littering these pages!

One bit that was particular annoying was that when comments come in, the administrator is supposed to be emailed a notification of such. But this wasn’t working.

I hit all the pages on Google pertaining to the problem (and it has been a problem for some time, apparently, centered around hosting WordPress on various webhosts), but still no luck.

Finally, I came across a mention of the ShiftThis Swift SMTP Plugin for WordPress. Looked like exactly what I was needing.

A quick download (and upload) later, and I was looking at the configuration screen.

Unfortunately, my first set of config didn’t work. Actually, it through a big, nasty exception all over the screen.

So did rounds 2 and 3. Round 4 got a little closer, the exception indicated that “authorization had failed for the username and password”.

Better.

Eventually, I worked out this set of config values (I’ve annoted the config screen below), and they DO seem to work just fine with my webhost (hosting under Windows).

image

Of course, your mileage may vary.

The key points for me, anyway, were:

  • The Server Address. It needs to be the name of the SMTP server OF THE WEB HOSTING MACHINE your website is hosted on. For instance, if WordPress is configured for the site MyDomain.com, this will likely be smtp.mydomain.com.
  • The Username. For me, it needed to be the FULLNAME (with the @domain.com part) of a mailbox configured ON THE WEB HOSTING MACHINE your website is hosted on. Following from the above example, I might use mail@mydomain.com
  • The Password. Even though my mailbox has a password, I had to leave this blank, or authentication would fail every time.

And there you have it!