uninstall.php 726 B

1234567891011121314151617181920212223242526
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. exit; // Exit if accessed directly
  4. }
  5. // if uninstall not called from WordPress exit
  6. if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
  7. exit;
  8. }
  9. /*
  10. * Only remove ALL product and page data if WC_REMOVE_ALL_DATA constant is set to true in user's
  11. * wp-config.php. This is to prevent data loss when deleting the plugin from the backend
  12. * and to ensure only the site owner can perform this action.
  13. */
  14. if ( defined( 'WC_REMOVE_ALL_DATA' ) && true === WC_REMOVE_ALL_DATA ) {
  15. // Delete options.
  16. delete_option( 'woocommerce_laybuy_settings' );
  17. // temp
  18. $laybuyPage = get_page_by_path( 'laybuy' );
  19. if ($laybuyPage) {
  20. wp_delete_post($laybuyPage->ID, true);
  21. }
  22. }