WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm testing different layouts for my admin pages, and the easiest way I found to determine which layout to load is with URL parameters. One of those parameters is "fullscreen=1" which hides the admin menu, for instance. The problem is, whenever I save a post / custom post type by submitting a form, WordPress will redirect me without preserving my parameter, thus breaking my layout by adding back the admin menu...

Is there an easy way to achieve this?

share|improve this question
up vote 1 down vote accepted

I finally figured this one out. Turns out I was so focused on filters and actions that I forgot about the basics.

In order to preserve any custom URL parameters after saving a post (via submitting the form) do the following:

Filter your admin URL with a conditional that checks for the parameter you want to preserve (based on this answer), like this:

function add_fullscreen_param( $link ) {
    if(isset($_REQUEST['fullscreen']) && $_REQUEST['fullscreen'] == '1') {
        $params['fullscreen'] = '1';
    $link = add_query_arg( $params, $link );

    return $link;

Then, all you have to do is make sure you send that request along with your form, because it will activate the filter above prior to redirecting back to your post / page / custom post type. To do this, simply add a hidden input.

if(isset($_REQUEST['fullscreen']) && $_REQUEST['fullscreen'] == '1') {  
    echo('<input type="hidden" name="fullscreen" value="1" />');

So if you access /wp-admin/post.php?post=100&action=edit&fullscreen=1, that last parameter will be there after saving the form.

share|improve this answer
Thanks saved my bacon! I started to get some odd behaviour (admin CSS thrown out, couldn't get in admin through top bar) with the code as it is. I swapped it round so the new link is within the if statement, which solved matters, I have no idea why! if( _POST['profile_type'] ) { $params['profile_type'] = $_POST['profile_type']; $link = add_query_arg( $params, $link ); } return $link; – danbrown May 12 '14 at 15:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.