Skip to content

Commit

Permalink
fix: offload redirects pointing to old page
Browse files Browse the repository at this point in the history
  • Loading branch information
abaicus committed Jul 31, 2023
1 parent baf766d commit ddbc391
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions inc/media_offload.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,11 +596,11 @@ public function add_inline_media_action( $actions, $post ) {
if ( ! self::is_uploaded_image( $file ) ) {
$upload_action_url = add_query_arg(
[
'action' => 'offload_images',
'media[]' => $post->ID,
'_wpnonce' => wp_create_nonce( 'bulk-media' ),
'page' => 'optimole',
'optimole_action' => 'offload_images',
'0' => $post->ID,
],
'upload.php'
'admin.php'
);

$actions['offload_images'] = sprintf(
Expand All @@ -613,11 +613,11 @@ public function add_inline_media_action( $actions, $post ) {
if ( self::is_uploaded_image( $file ) ) {
$rollback_action_url = add_query_arg(
[
'action' => 'rollback_images',
'media[]' => $post->ID,
'_wpnonce' => wp_create_nonce( 'bulk-media' ),
'page' => 'optimole',
'optimole_action' => 'rollback_images',
'0' => $post->ID,
],
'upload.php'
'admin.php'
);
$actions['rollback_images'] = sprintf(
'<a href="%s" aria-label="%s">%s</a>',
Expand Down Expand Up @@ -867,9 +867,9 @@ public function bulk_action_handler( $redirect, $doaction, $image_ids ) {
if ( empty( $image_ids ) ) {
return $redirect;
}
$redirect = remove_query_arg( [ 'optimole_offload_images_succes', 'optimole_offload_images_failed', 'optimole_back_to_media_success', 'optimole_back_to_media_failed', 'optimole_offload_images_extra', 'optimole_rollback_images_extra' ], $redirect );
$image_ids = array_slice( $image_ids, 0, 20, true );

$image_ids = array_slice( $image_ids, 0, 20, true );
$redirect = 'admin.php';
$redirect = add_query_arg( 'optimole_action', $doaction, $redirect );
$redirect = add_query_arg( 'page', 'optimole', $redirect );
$redirect = add_query_arg( $image_ids, $redirect );
Expand Down

0 comments on commit ddbc391

Please sign in to comment.