Woocommerce How To Remove Review Image

WooCommerce: How to Remove Review Images (The Beginner’s Guide)

Want to clean up your WooCommerce product reviews and get rid of those images users are uploading? Maybe you’re dealing with inappropriate content, or perhaps you just prefer a cleaner, text-focused look. Whatever the reason, removing review images from your WooCommerce store is a common request. Don’t worry, it’s achievable even if you’re not a coding whiz!

This guide will walk you through simple and effective methods to remove those review images, tailored for beginners who want a quick, practical solution. Let’s get started!

Why Remove Review Images?

Before we dive into the “how,” let’s quickly understand the “why.” Here are a Explore this article on How To Add Custom Woocommerce Css few reasons why you might want to remove review images:

    • Inappropriate Content: This is the most common reason. Sometimes, users upload images that are offensive, irrelevant, or violate your store’s guidelines. Removing them helps maintain a professional and safe environment. Imagine selling children’s toys and someone posts a review picture that is clearly not child-friendly. You’d want to remove that ASAP!
    • Aesthetics and Branding: You might prefer a cleaner, more uniform look. If review images aren’t consistent in quality or style, they can detract from your website’s overall design. You may want reviews that are focused on text descriptions and ratings only.
    • Moderation Overload: Constantly moderating images can be time-consuming. Removing the option eliminates this task, freeing you up for other important aspects of your business.
    • Performance Issues: While not usually a major issue, too many large review images can potentially slow down page load times.

    Method 1: Using CSS to Hide Review Images (Easiest!)

    This is the simplest and often most effective way to remove review images, especially if you just want to hide them visually without altering the underlying code. We’ll use CSS (Cascading Style Sheets) to tell Check out this post: How To Add Detailed Instructions To Woocommerce the browser *not* to display the images.

    1. Access the WordPress Customizer: Go to your WordPress Dashboard, then navigate to *Appearance > Customize*.

    2. Find the Custom CSS Section: Look for a section labeled “Additional CSS,” “Custom CSS,” or something similar. This is where you can add your own CSS rules.

    3. Add the CSS Code: Paste the following code into the CSS editor:

    .woocommerce #reviews .commentlist .comment_container .comment-text .woocommerce-review__dash .woocommerce-review__verified-owner {

    display: none !important; /* Hides the “verified owner” badge, which often accompanies the image. */

    }

    .woocommerce #reviews .commentlist .comment_container .comment-text img {

    display: none !important; /* Hides the actual review image. */

    }

    Explanation:

    • `.woocommerce #reviews .commentlist .comment_container .comment-text img`: This targets the `img` element (the image) within the review comments Check out this post: How To Get Tracking Info From Shippo To Woocommerce section of your WooCommerce product pages. The specificity ensures it only affects images in the product reviews.
    • `display: none !important;`: This is the key part! It tells the browser not to display the image. `!important` ensures this rule overrides any other conflicting CSS rules.
    • `.woocommerce #reviews .commentlist .comment_container .comment-text .woocommerce-review__dash .woocommerce-review__verified-owner`: This targets the “verified owner” badge which could be next to the image. Hiding this as well gives a cleaner look.

    4. Publish Your Changes: Click the “Publish” button at the top of the Customizer to save your changes.

    5. Test: Go to a product page with reviews that have images. The images should now be gone!

    Important Note: This method *hides* the images, it doesn’t physically delete them from your server. If you were to disable the CSS, the images would reappear.

    Method 2: Using a Plugin (Intermediate, but No-Code Solution)

    If you’re not comfortable with CSS (though the above method is pretty safe!), you can use a plugin specifically designed for managing WooCommerce reviews. Some plugins offer options to disable or remove review images.

    Example: Search for plugins like “WooCommerce Product Reviews” or “Review Management for WooCommerce.” Some popular options might include settings to disable the image upload feature altogether, or to hide existing images.

    Important Note: Research plugins carefully before installing them. Check their ratings, reviews, and compatibility with your version of WooCommerce and WordPress. Some plugins might come with a cost.

    Method 3: Using Code (Advanced, but Permanent)

    This method involves editing your theme’s `functions.php` file or creating a custom plugin. This is the most powerful but also the riskiest method, as incorrect code can break your website. Always back up your website before making any code changes!

    Here’s an example of PHP code you can use to remove the review image functionality completely:

     <?php /** 
  • Remove the review image field from WooCommerce product reviews.
  • */ function my_remove_review_image_field( $comment_id ) { // Get the image ID associated with the comment. $image_id = get_comment_meta( $comment_id, 'review_image_id', true );

    // If an image ID exists, delete it.

    if ( $image_id ) {

    wp_delete_attachment( $image_id );

    }

    // Delete the comment meta data associated with the image.

    delete_comment_meta( $comment_id, ‘review_image_id’ );

    }

    add_action( ‘delete_comment’, ‘my_remove_review_image_field’ );

    /

    * Remove the ability to upload images in reviews

    */

    function remove_review_image_upload() {

    remove_action( ‘comment_form_after_fields’, ‘woocommerce_review_image_upload_form_field’ );

    }

    add_action( ‘after_setup_theme’, ‘remove_review_image_upload’ );

    ?>

    Explanation:

    1. `my_remove_review_image_field( $comment_id )`: This function runs when a comment is deleted. It retrieves the ID of the image associated with the review (if any) and then deletes both the image attachment and the metadata linking the image to the review.

    2. `add_action( ‘delete_comment’, ‘my_remove_review_image_field’ )`: This tells WordPress to run the `my_remove_review_image_field` function whenever a comment is deleted. This ensures images associated with deleted reviews are also removed.

    3. `remove_review_image_upload()`: This function removes the default action which loads the image uploader for reviews.

    4. `add_action( ‘after_setup_theme’, ‘remove_review_image_upload’ )`: This tells WordPress to remove the upload box on theme setup.

    How to Implement:

    1. Back Up Your Website: Absolutely crucial!

    2. Edit `functions.php` or Create a Plugin:

    * `functions.php`: Navigate to *Appearance > Theme Editor* (or *Theme File Editor*). Find the `functions.php` file and paste the code at the end.

    * Create a Plugin: This is the recommended method, as it’s more organized and less likely to be overwritten by theme updates. Create a new PHP file (e.g., `remove-review-images.php`) and paste the code into it. Then, upload and activate the plugin through your WordPress Dashboard.

    3. Save Changes: Click “Update File” (or activate your plugin).

    4. Test: Go to a product page and try to leave a review. The image upload option should be gone. Also, try deleting a review that previously had an image attached to it.

    Why is this method more complex?

    • Code Knowledge Required: You need to understand PHP to modify this code safely.
    • Potential for Errors: Even a small typo can break your website.
    • Theme Updates: Changes to `functions.php` might be overwritten when you update your theme. That’s why creating a custom plugin is the preferred approach.
    • Permanent Removal: This method permanently removes the ability to upload images and deletes existing review images. There’s no easy way to undo it without restoring your website from a backup.

    Choosing the Right Method

    • Beginner (No Coding): Use Method 1 (CSS). It’s the easiest and safest way to hide images.
    • Intermediate (Comfortable with Plugins): Use Method 2 (Plugin). Look for a well-rated, compatible plugin that meets your needs.
    • Advanced (Coding Experience): Use Method 3 (Code). This gives you the most control but requires caution.

    Important Reminders:

    • Backups! Always back up your website before making changes to your theme’s `functions.php` file or database.
    • Testing: Test your changes thoroughly on a staging site (a copy of your website) before applying them to your live site.

By following these steps, you can successfully remove review images from your WooCommerce store and achieve the look and feel you desire! Good luck!

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *