Stray random quotes plugin refresh fix

Pre-Amble

Back in the day, I decided to use the stray random quotes plugin to place a random quote at the bottom of each page. It worked, and still does. Only, if you clicked on a quote it didn’t refresh – instead it said ‘Loading…’ and then placed an error in my web server log like this (not that it looked like you could even click on a quote anyway – the mouse cursor didn’t change to the ‘pointy-finger’):

I’ve known it didn’t work for ages, but not especially cared, and then this morning I’m putting off doing actual work, so I fixed it.

The Fix

The problem was that like many people, I’ve moved the file wp-config.php outside of the web-facing folder, so instead of living in /var/www/ it actually lives in /var/. Stray_random_quotes tells you that if you’ve moved your wp-config.php then you need to provide the modified path in stray_ajax.php itself, right near the top – so do so!

The first two lines of stray_ajax.php should now read:

That should do ‘er – now, stray_ajax.php should be able to call wp-config, which will allow it to call get_stray_quotes().

Further

When monkeying with wp-config, I saw that it was calling wp-settings, but the call was failing because they expect to be in the same folder, only as mentioned – wp-config.php is up a level from wp-settings.php (which holds no credentials), so, to fix this:

– Edit /var/wp-settings.php and right at the bottom, change the path to the wp-config.php file to be:

Leave a Reply

Your email address will not be published.