-
-
Save lukecav/6a99b1e58e0176c13ec8eb2c9d2daa64 to your computer and use it in GitHub Desktop.
add_filter( 'woocommerce_register_post_type_product', 'wc_modify_product_post_type' ); | |
function wc_modify_product_post_type( $args ) { | |
$args['supports'][] = 'revisions'; | |
return $args; | |
} |
Thanks for this - I wasn't aware until now about the woocommerce_register_post_type_product
filter. That'll definitely come in useful for me for future projects.
This is a very useful feature to use but in terms of having a revision system with role-based approvals there will certainly have to be more of an in-depth solution for WooCommerce products
If anyone tries this and doesn't see Revisions in their Publish widget at the top right corner, then your WP host has probably disabled revisions at the host level. WPEngine for instance doesn't allow revisions on any post types, by default. You can contact them to flip it on, but they have misc. restrictions that make it all be useless as a feature.
Does this code still work? Or is it not working for me because I'm trying to insert it using the WPCode plugin?
Does this code still work? Or is it not working for me because I'm trying to insert it using the WPCode plugin?
If the host doesn't have it disabled, try using Code Snippets first. If it works there, then the issue is WPCode:
https://wordpress.org/plugins/code-snippets/
https://wordpress.stackexchange.com/questions/238905/adding-revision-support-to-woocommerce-product-content