The snippet has been recently deactivated due to an error on this line
-
I am getting the message “The snippet has been recently deactivated due to an error on this line” on the bolded line.
add_filter( ‘mfrh_new_filename’, ‘my_custom_filename’, 10, 3 ); function my_custom_filename($new, $old, $post) { // Get the ACF field $acf_field = get_field(‘your_acf_field’, $post->ID); $product_index = get_option(‘_product_index’, 1); // Generate filename $filename = ‘web_’ . sprintf(‘%04d’, $product_index) . ‘ – ‘ . sanitize_title(get_the_title($post->ID)) . ‘ – ‘ . $acf_field; // Increment the product index for the next upload update_option(‘_product_index’, $product_index + 1); return $filename; }
- The topic ‘The snippet has been recently deactivated due to an error on this line’ is closed to new replies.