Skip to content

Commit

Permalink
Conditionally render media library link and update to add url param
Browse files Browse the repository at this point in the history
  • Loading branch information
arunshenoy99 committed Dec 27, 2024
1 parent 774774b commit 9b311a5
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions components/imageOptimizationSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const ImageOptimizationSettings = ( { methods } ) => {

const mediaLibraryLink = () => {
const basePath = window.location.pathname.split( '/wp-admin' )[ 0 ];
return `${ window.location.origin }${ basePath }/wp-admin/upload.php`;
return `${ window.location.origin }${ basePath }/wp-admin/upload.php?autoSelectBulk=true`;
};

return (
Expand Down Expand Up @@ -198,15 +198,17 @@ const ImageOptimizationSettings = ( { methods } ) => {
defaultText.imageOptimizationBulkOptimizeDescription
}
</p>
<a
href={ mediaLibraryLink() }
target="_blank"
rel="noopener noreferrer"
>
{
defaultText.imageOptimizationBulkOptimizeButtonLabel
}
</a>
{ bulkOptimization && (
<a
href={ mediaLibraryLink() }
target="_blank"
rel="noopener noreferrer"
>
{
defaultText.imageOptimizationBulkOptimizeButtonLabel
}
</a>
) }
</>
}
checked={ bulkOptimization }
Expand Down

0 comments on commit 9b311a5

Please sign in to comment.