$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
remove_filter( ‘comment_text’, ‘make_clickable’, 9 );Continue reading
add_filter(‘wp_is_application_passwords_available’, ‘__return_false’);Continue reading
add_filter( ‘wp_theme_json_data_theme’, function ( $theme_json ) { $new_data = array( ‘settings’ => array( ‘color’ => array( ‘palette’ => array( // Replace with your desired colors. array( ‘slug’ => ‘white’, ‘color’ => ‘#ffffff’, ‘name’ => ‘White’, ), array( ‘slug’ => ‘black’,…Continue reading