Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tozani

    (@tozani)

    OK, I managed to find a snippet code to bypass the issue by preventing my plugin from uploading image files to Amazon S3.

    I don’t need to trigger the default view anymore (for some reason, thumbnails were not displayed in classic view in grid mode, used by woocommerce and other plugins)

    But you should check this, because I tested with 3 different plugins that upload files on Amazon S3, and it always was the same issue.

    Thread Starter tozani

    (@tozani)

    I added a function via a custom code I found online :

    add_action(‘admin_init’, function() {

    if ( strpos(admin_url(‘upload.php’), $_SERVER[‘REQUEST_URI’]) !== false
    || (isset($_GET[‘mode’]) && $_GET[‘mode’] === ‘list’) ) {
    wp_redirect(admin_url(‘upload.php?mode=grid’));
    exit;
    }

    }, 100);

    It works but only for the admin menu. Don’t work for woocommerce or on frontend, where people can actually post their products via WC Vendors.

    For example, if I inspect via firefox console on a page that allows file uploads, I can see this code :

    href=”https://my-website.com/wp-admin/upload.php?mode=list”>
    <span class=”screen-reader-text”>List view</span>

    href=”https://my-website.com/wp-admin/upload.php?mode=grid”&gt;
    <span class=”screen-reader-text”>Grid view</span>

    https://ibb.co/sKdNr5c

    What I need is to search into upload.php and replace the correct terms. But I would like to find a snippet code to modify the file, and not modifying the file directly…
    Maybe the same snippet I used but edited with proper terms. And I don’t know what are the terms for the same actions on frontend.

    Thanks a lot ??

    • This reply was modified 3 years, 3 months ago by tozani.
    • This reply was modified 3 years, 3 months ago by tozani.
Viewing 2 replies - 1 through 2 (of 2 total)