Title: [Plugin: Widget Context] can&#039;t target page by URL
Last modified: August 19, 2016

---

# [Plugin: Widget Context] can't target page by URL

 *  [dralezero](https://wordpress.org/support/users/dralezero/)
 * (@dralezero)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-widget-context/)
 * I am using WordPress 3.0.1 MU. I try to target a widget by URL so it only shows
   on that page but it won’t show. Nor can I show on all and hide on that URL. It
   just shows on all. All other options work such as showing on only Single pages.
 * I tried full url with http:// and `/page/*` `page/*` `page/`, etc
 * [http://wordpress.org/extend/plugins/widget-context/](http://wordpress.org/extend/plugins/widget-context/)

Viewing 15 replies - 1 through 15 (of 38 total)

1 [2](https://wordpress.org/support/topic/plugin-widget-context/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/plugin-widget-context/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-widget-context/page/2/?output_format=md)

 *  [liaaz](https://wordpress.org/support/users/liaaz/)
 * (@liaaz)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1644902)
 * it works for me
    please don’t include the ending slash and than try i.e use only`
   page`
 *  [takeok](https://wordpress.org/support/users/takeok/)
 * (@takeok)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1644982)
 * Thank you! The examples should mention NOT using a trailing slash UNLESS it’s
   being used in combination with a wildcard. I tried everything (or so I thought)
   and was going mad! I could not get it to work at all. I was using the following:
 * programs/ohio/
    programs/ohio/*
 * but thanks to this post I tried the below and it now works! Thank you!
 * programs/ohio
    programs/ohio/*
 *  [farfromfearless](https://wordpress.org/support/users/farfromfearless/)
 * (@farfromfearless)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1644986)
 * I’m trying to use this plugin with WP 3.0 Multisite, but for some reason, the
   target by url approach isn’t working at all. This is my setup:
 * 1. I have two blogs:
    – [http://www.mydomain.com/en/](http://www.mydomain.com/en/)–
   [http://www.mydomain.com/fr/](http://www.mydomain.com/fr/)
 * 2. I’m attempting to show a widget *only* on a page as such:
    – [http://www.mydomain.com/en/some-page-name/](http://www.mydomain.com/en/some-page-name/)–
   using the following rule in WidgetContext: – some-page-name – some-page-name/*–
   No such luck.
 * 3. I have even tried with the following rules:
    – en/some-page-name – en/some-
   page-name/* – fr/some-page-name – fr/some-page-name/*
 * Is this plugin compatible with WP Multisite? I have had great success with it
   on standalone installations of WP, but this is the first time I’ve tried using
   it with MultiSite. Any suggestions would be most welcome.
 *  [cedarhs](https://wordpress.org/support/users/cedarhs/)
 * (@cedarhs)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1644992)
 * I think it must be something buggy with the plugin (or it has something to do
   with the WordPress install?).
 * It’s strange, I was running WordPress 3.0.1 on a Window XP localhost install.
   This pluging (ver0.7) was working great.
 * A coworkder migrated the site to a Server 2003 machine, using IIS, I reinstalled
   all the plugins I used on the previous box, and now I Widget Context isn’t working.
   All the widgets I want on the front page are there, however, when I select a 
   TEXT box widget, SHOW ON SELECTED (all unchecked) –> TARGET BY URL: [http://192.168.150.4:88/wordpress/?page_id=17](http://192.168.150.4:88/wordpress/?page_id=17)
 * It won’t show. I tried many combinations, but this was the format I used on my
   XP box, and as I said, it worked fine that way.
 * I even tried DISPLAY WIDGETS plugin too, and that won’t work. I’m guessing it
   might have something with the IIS configuration?
 * I’m curious, are the rest of you also using IIS?
 *  [jpmorganjr](https://wordpress.org/support/users/jpmorganjr/)
 * (@jpmorganjr)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1644993)
 * Sorry I don’t know how to update plugins in the wordpress plugin database, but
   here’s a fix:
 * In widget-context.php change this function:
 * ** function get_current_url() {
    if ($_SERVER[‘REQUEST_URI’] == ”) $uri = $_SERVER[‘
   REDIRECT_URL’]; else $uri = $_SERVER[‘REQUEST_URI’];
 *  $url = (!empty($_SERVER[‘HTTPS’]))
    ? “[http://&#8221](http://&#8221);.$_SERVER[‘
   SERVER_NAME’].$uri : “[http://&#8221](http://&#8221);.$_SERVER[‘SERVER_NAME’].
   $uri;
 *  if (substr($url, -1) == ‘/’)
    $url = substr($url, 0, -1);
 *  return $url;
    }
 * To this one:
 * ** function get_current_url() {
    $uri = $_SERVER[‘REQUEST_URI’]; if (substr($
   uri, -1) == ‘/’) $uri = substr($uri, 0, -1); return $uri; }
 * You won’t be able to use the http or https versions of the target by URL anymore,
   but you shouldn’t be able to anyway because all the widgets are on the same domain.
 * If I had more time I’d do a proper debug, but I’m in a hurry and wanted to share
   this because it’s the only plugin that offers this solution and I know plenty
   of others need it to work!!
 *  [cedarhs](https://wordpress.org/support/users/cedarhs/)
 * (@cedarhs)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1644994)
 * Hi. Thanks for posting this. I wasn’t able to get this working based on your 
   code. 🙁
 *  [jpmorganjr](https://wordpress.org/support/users/jpmorganjr/)
 * (@jpmorganjr)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1644995)
 * What are you entering as the URL(s)?
 *  [kongenidalen](https://wordpress.org/support/users/kongenidalen/)
 * (@kongenidalen)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645000)
 * Finally somebody got it right…Big thank you jpmorganjr
    🙂 worked like a charm…
   show or hide with url entering as follows: /blogname/pageid…basicly everything
   but the http and domain name. repeat as many page as you like… Cheers
 *  [Scott Hendison](https://wordpress.org/support/users/cyber49/)
 * (@cyber49)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645006)
 * Aha! –
 * > everything but the http and domain name.
 * It DOES seem to work correctly. I’m likin’ this a lot, it came installed on a
   new clients site, so just stumbled across it – I’m donating the author something
   right now, (and you should too) 😉
 *  [mrwweb](https://wordpress.org/support/users/mrwweb/)
 * (@mrwweb)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645016)
 * +1 to jpmorganjr. This did fix it.
 * Just to be clear for others doing this, the syntax for targeting URLs differs
   from the widget-context documentation. Instead of “pagename” you enter “/pagename”.
 * Thanks again!
 *  [Subvillain](https://wordpress.org/support/users/subvillain/)
 * (@subvillain)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645018)
 * Try */?page_id=123
    or */pagename
 *  [jabberjack](https://wordpress.org/support/users/jabberjack/)
 * (@jabberjack)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645019)
 * Nice Plugin – install and it works! Thanks for your coding time! Makes my WPMU
   site look and run a LOT better.
 *  [butnotphilcollinsgood](https://wordpress.org/support/users/butnotphilcollinsgood/)
 * (@butnotphilcollinsgood)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645026)
 * +2 to jpmorganjr. Did the trick. Really appreciate your time and efforts!
 *  [nojmike](https://wordpress.org/support/users/nojmike/)
 * (@nojmike)
 * [15 years ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645028)
 * +3 to jpmorganjr. What a hero.
 *  [solutionsphp](https://wordpress.org/support/users/solutionsphp/)
 * (@solutionsphp)
 * [15 years ago](https://wordpress.org/support/topic/plugin-widget-context/#post-1645029)
 * Thanks jpmorganjr! The fix posted got this plugin working for me.

Viewing 15 replies - 1 through 15 (of 38 total)

1 [2](https://wordpress.org/support/topic/plugin-widget-context/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/plugin-widget-context/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-widget-context/page/2/?output_format=md)

The topic ‘[Plugin: Widget Context] can't target page by URL’ is closed to new replies.

 * 38 replies
 * 26 participants
 * Last reply from: [bigdanprice](https://wordpress.org/support/users/bigdanprice/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-widget-context/page/3/#post-1645083)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
