I often develop sites on my local machine before committing and transferring to a staging/live server, so during the development phase most of my sites reside on a URL similar to http://localhost:8800.

I was recently developing a WordPress site for a client and needed to show certain widgets depending on the current page, so the Widget Context plugin seemed ideal. However on my local machine I couldn’t get it to work, and couldn’t find anyone else on the web who had the same problem as me.

So as I started routing through the code, I noticed in widget-context.php the function “get_current_url”. I’m not sure why the developer didn’t just use get_bloginfo(‘siteurl’) (I’ve asked him via a discussion on the Wordpress Site), and another alternative is to use HTTP_HOST from the $_SERVER array, instead of SERVER_NAME.

« Back