• 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)
  • 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

    (@minklet)

    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

    (@minklet)

    of course I mean that I would then have to hard code the rest of the url after bloginfo

    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.