Try this, using mkdir:
if (!file_exists('path/to/directory')) {
mkdir('path/to/directory', 0777, true);
}
Note that 0777
is already the default mode for directories and may still be modified by the current umask.
More Related Contents:
- Fatal error: Switch statements may only contain one default clause (php7)
- Not receiving emails [phpmailer]
- How to get like ‘next monday’ records from mysql database?
- How to Use AJAX in a WordPress Shortcode?
- The plugin generated X characters of unexpected output during activation (WordPress)
- Nginx serves .php files as downloads, instead of executing them
- Replace the Variable Price range by the chosen variation price in WooCommerce 3
- Listing all the folders subfolders and files in a directory using php
- Change product prices via a hook in WooCommerce 3+
- Checking if customer has already bought something in WooCommerce
- With “magic quotes” disabled, why does PHP/WordPress continue to auto-escape my POST data?
- Display the discounted percentage near sale price in Single product pages for WC 3.0+
- WooCommerce: Assigning an endpoint to a custom template in my account pages
- Create programmatically a variable product and two new attributes in WooCommerce
- How can I get customer details from an order in WooCommerce?
- Insert PHP code In WordPress Page and Post
- Loop code for each file in a directory [duplicate]
- Add fee based on specific payment methods in WooCommerce
- Change COD default order status to “On Hold” instead of “Processing” in Woocommerce
- PHP, cURL post to login to WordPress
- Get coupon data from WooCommerce orders
- Show stock status next to each attribute value in WooCommerce variable products
- Turn off deprecated errors in PHP 5.3
- WordPress Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /wp-includes/wp-db.php:1570
- Custom order status background button color in Woocommerce 3.3 admin order list
- Facebook SDK returned an error: Cross-site request forgery validation failed. The “state” param from the URL and session do not match
- Redirecting WordPress’s Login/Register page to a custom login/registration page
- Remove attribute values from product variation title and show them on separate rows
- Multi checkbox fields in Woocommerce backend
- Show hide custom Woocommerce checkout field based on selected payment method