Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

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 answerbased on this answer), like this:

add_filter('admin_url','add_fullscreen_param');
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.

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:

add_filter('admin_url','add_fullscreen_param');
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.

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:

add_filter('admin_url','add_fullscreen_param');
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.

Source Link
Tomas Buteler
  • 3.9k
  • 2
  • 27
  • 29

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:

add_filter('admin_url','add_fullscreen_param');
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.