Last active
November 6, 2022 11:05
-
-
Save EricBusch/75169e64fd244efae226c5c3c04764c4 to your computer and use it in GitHub Desktop.
Prevent the product name, product description and product excerpt from being overwritten during a Product Set update. [datafeedr]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Prevent product titles, descriptions & excerpts from being overwritten during Product Set updates. | |
*/ | |
add_filter( 'dfrpswc_filter_post_array', 'mycode_prevent_product_title_content_excerpt_override', 999, 4 ); | |
function mycode_prevent_product_title_content_excerpt_override( $post, $product, $set, $action ) { | |
if ( $action == 'update' ) { | |
unset( $post['post_title'] ); // Prevent title from being overwritten. | |
unset( $post['post_content'] ); // Prevent description from being overwritten. | |
unset( $post['post_excerpt'] ); // Prevent excerpt from being overwritten. | |
} | |
return $post; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment