• I’m building a stock image website, and I want the previews to be watermarked but not the downloadable full quality images.

    From this page on Dfactory’s website, I got this code

    function custom_iw_watermark_display($attachment_id) {
    	// do this in admin only
    	if (is_admin()) {
    		// get uploaded file url
    		$attachment_link = get_attachment_link($attachment_id);
    		// check if file path points to woocommerce upload folder
    		if (strpos($attachment_link, 'woocommerce_uploads') !== false) {
    			// if it does, disable watermarking of this specific image
    		    $attachment_id = false;
    		}
    	}
    	return $attachment_id;
    }
    add_filters('iw_watermark_display', 'custom_iw_watermark_display');

    But it returns and doesn’t even save it

    Your PHP code changes were rolled back due to an error on line 137 of file wp-content/themes/hello-elementor-child-theme/functions.php. Please fix and try saving again.
    
    Uncaught Error: Call to undefined function add_filters() in wp-content/themes/hello-elementor-child-theme/functions.php:137
    Stack trace:
    #0 wp-settings.php(591): include()
    #1 wp-config.php(99): require_once('/home/stockavn/...')
    #2 wp-load.php(50): require_once('/home/stockavn/...')
    #3 wp-admin/admin.php(34): require_once('/home/stockavn/...')
    #4 wp-admin/theme-editor.php(10): require_once('/home/stockavn/...')
    #5 {main}
      thrown
    

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author dFactory

    (@dfactory)

    Hi,

    There’s a typo there. Name of the function should be apply_filters, not add_filters. Updating that on the site

    Thread Starter fitmasu

    (@fitmasu)

    It saves now, but it doesn’t work ?? Still watermarks downloadable images.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disabling Woocommerc Downloadable Images from Being Watermarked’ is closed to new replies.