Disable WP Texturize
// Disable curly quotes remove_filter( ‘the_content’, ‘wptexturize’ );Continue reading
Join 2,000,000+ Professionals who use WPCode to Future-Proof Their Websites!
// Disable curly quotes remove_filter( ‘the_content’, ‘wptexturize’ );Continue reading
// Disable image compression add_filter( ‘jpeg_quality’, ‘smashing_jpeg_quality’ ); function smashing_jpeg_quality() { return 100; } // Disable image scaling add_filter( ‘big_image_size_threshold’, ‘__return_false’ );Continue reading
function create_custom_directory($dir_name) { $upload_dir = wp_upload_dir(); // Get the uploads directory array $custom_dir = $upload_dir[‘basedir’] . ‘/’ . $dir_name; // Specify the custom folder if (!file_exists($custom_dir)) { wp_mkdir_p($custom_dir); if(file_exists($custom_dir)) { return “Directory created successfully.”; } else { return “Failed to…Continue reading
$file = ‘/path/to/file.png’; $filename = basename($file); $upload_file = wp_upload_bits($filename, null, file_get_contents($file)); if (!$upload_file[‘error’]) { $wp_filetype = wp_check_filetype($filename, null ); $attachment = array( ‘post_mime_type’ => $wp_filetype[‘type’], ‘post_parent’ => $parent_post_id, ‘post_title’ => preg_replace(‘/\.[^.]+$/’, ”, $filename), ‘post_content’ => ”, ‘post_status’ => ‘inherit’ );…Continue reading
add_action(‘woocommerce_order_status_completed’, ‘create_user_and_notify_on_order_completion_with_masterstudy’); function create_user_and_notify_on_order_completion_with_masterstudy($order_id) { $order = wc_get_order($order_id); $customer_email = $order->get_billing_email(); // Find user by email $user = get_user_by(’email’, $customer_email); if ($user) { // Existing user found, update ‘customer’ role if (!in_array(‘customer’, $user->roles)) { $user->add_role(‘customer’); } // Update order to…Continue reading
add_action(‘woocommerce_order_status_completed’, ‘create_user_and_notify_on_order_completion’); function create_user_and_notify_on_order_completion($order_id) { $order = wc_get_order($order_id); $customer_email = $order->get_billing_email(); // Find user by email $user = get_user_by(’email’, $customer_email); if ($user) { // Existing user found, update ‘customer’ role if (!in_array(‘customer’, $user->roles)) { $user->add_role(‘customer’); } // Update order to…Continue reading
function custom_woo_ce_get_product_title_attribute_formatting( $format = ‘slug’, $post_id ) { // Set the format to Attribute Title $format = ‘title’; return $format; } add_filter( ‘woo_ce_get_product_title_attribute_formatting’, ‘custom_woo_ce_get_product_title_attribute_formatting’, 10, 2 );Continue reading
function custom_woo_ce_extend_order_fields( $fields ) { $fields[] = array( ‘name’ => ‘shipping_address_full’, ‘label’ => ‘Shipping: All details’, ‘hover’ => ‘Custom Order field within functions.php’ ); return $fields; } add_filter( ‘woo_ce_order_fields’, ‘custom_woo_ce_extend_order_fields’ ); function custom_woo_ce_extend_order( $order, $order_id ) { $order->shipping_address_full = ”;…Continue reading