Title: $_SERVER[&#039;PHP_SELF&#039;] doesn&#039;t work
Last modified: August 19, 2016

---

# $_SERVER['PHP_SELF'] doesn't work

 *  [minklet](https://wordpress.org/support/users/minklet/)
 * (@minklet)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/_serverphp_self-doesnt-work/)
 * I’m noticing that a lot of plugins are breaking in mulitisite because $_SERVER[‘
   PHP_SELF’] kicks out the wrong result, it gives the url for the main blog.
 * What can I use to replace it?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [David Sader](https://wordpress.org/support/users/dsader/)
 * (@dsader)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/_serverphp_self-doesnt-work/#post-1676849)
 * The only notes I have about PHP_SELF is in the context related to template searchform.
   php, haven’t seen it break plugins, only searches.
 * `<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?
   >">`
 * becomes
 * `<form id="searchform" method="get" action="<?php bloginfo('home'); ?>/">`
 *  Thread Starter [minklet](https://wordpress.org/support/users/minklet/)
 * (@minklet)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/_serverphp_self-doesnt-work/#post-1676866)
 * Well, it breaks plugin options screens because the action points to blog/wp-admin/
   options etc rather than blog/site/wp-admin/options etc
 * It’s going down a directory. Which means that the results of the form aren’t 
   being processed and it is impossible to save anything. I’ve seen this happen 
   on quite a few plug ins now.
 * Will <?php bloginfo(‘url’) work in the admin page? I can only try it I suppose.
 *  Thread Starter [minklet](https://wordpress.org/support/users/minklet/)
 * (@minklet)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/_serverphp_self-doesnt-work/#post-1676867)
 * of course I mean that I would then have to hard code the rest of the url after
   bloginfo
 *  [David Sader](https://wordpress.org/support/users/dsader/)
 * (@dsader)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/_serverphp_self-doesnt-work/#post-1676874)
 * Tried this?
    `<form method="post" action="<?php echo esc_attr($_SERVER['REQUEST_URI']);?
   >">`

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘$_SERVER['PHP_SELF'] doesn't work’ is closed to new replies.

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 4 replies
 * 2 participants
 * Last reply from: [David Sader](https://wordpress.org/support/users/dsader/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/_serverphp_self-doesnt-work/#post-1676874)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
