View functions.php
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
// Remove sale price and use regular price when stock is 0 | |
function remove_sale_price_on_zero_stock( $price, $product ) { | |
// Check if the product is on sale and has stock | |
if ( $product->is_on_sale() && $product->get_stock_quantity() <= 0 ) { | |
$regular_price = $product->get_regular_price(); | |
$price = wc_price( $regular_price ); // Use regular price instead of sale price | |
} | |
return $price; | |
} | |
add_filter( 'woocommerce_product_get_price', 'remove_sale_price_on_zero_stock', 10, 2 ); |
View functions.php
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
function add_security_headers($headers) { | |
// Add X-XSS-Protection header | |
$headers['X-XSS-Protection'] = '1; mode=block'; | |
// Add X-Content-Type-Options header | |
$headers['X-Content-Type-Options'] = 'nosniff'; | |
// Add X-Frame-Options header | |
$headers['X-Frame-Options'] = 'SAMEORIGIN'; |
View functions.php
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
add_action( 'init', 'custom_wc_maybe_reduce_stock_levels', 10 ); | |
function custom_wc_maybe_reduce_stock_levels(){ | |
// remove_action( 'woocommerce_order_status_completed', 'wc_maybe_reduce_stock_levels' ); | |
remove_action( 'woocommerce_payment_complete', 'wc_maybe_reduce_stock_levels' ); | |
remove_action( 'woocommerce_order_status_processing', 'wc_maybe_reduce_stock_levels' ); | |
remove_action( 'woocommerce_order_status_on-hold', 'wc_maybe_reduce_stock_levels' ); | |
add_action( 'woocommerce_payment_complete', 'wc_maybe_increase_stock_levels' ); | |
add_action( 'woocommerce_order_status_processing', 'wc_maybe_increase_stock_levels' ); |
View Command
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
wp itsec site-scanner scan |
View functions.php
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
function extend_auth_cookie_expiration( $expiration, $user_id, $remember ) { | |
// Set the desired cookie expiration time (48 hours in this example) | |
$cookie_expire = 2 * DAY_IN_SECONDS; | |
// Return the new expiration time | |
return $cookie_expire; | |
} | |
add_filter( 'auth_cookie_expiration', 'extend_auth_cookie_expiration', 10, 3 ); |
View Command
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
wp plugin update essential-addons-for-elementor-lite |
View Command
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
wp option get itsec-storage --format=json |
View functions.php
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
function action_woocommerce_low_stock( $wc_get_product ) { | |
// Product set tag id(s), multiple IDs can be added, separated by a comma | |
$wc_get_product->set_tag_ids( array( 'YOUR TAG ID' ) ); | |
// OPTIONAL: Set category ids | |
//$wc_get_product->set_category_ids( array( 39, 2 ) ); | |
// Save | |
$wc_get_product->save(); | |
} |
View functions.php
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
function reset_product_template( $post_type_args ) { | |
if ( array_key_exists( 'template', $post_type_args ) ) { | |
unset( $post_type_args['template'] ); | |
} | |
return $post_type_args; | |
} | |
add_filter( 'woocommerce_register_post_type_product', 'reset_product_template' ); |
View .htaccess
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
<IfModule pagespeed_module> | |
ModPagespeed on | |
ModPagespeedEnableFilters recompress_jpeg,recompress_png | |
ModPagespeedEnableFilters recompress_webp | |
ModPagespeedEnableFilters convert_gif_to_png,convert_jpeg_to_progressive | |
ModPagespeedEnableFilters convert_jpeg_to_webp,convert_png_to_jpeg | |
ModPagespeedEnableFilters jpeg_subsampling | |
ModPagespeedEnableFilters strip_image_color_profile,strip_image_meta_data | |
</IfModule> |
NewerOlder