This is what i ended up using
/**
* check if the path is writable. To make the check .
*
* @param string $path
* @return boolean
*/
public static function is_writable( $path ) {
global $wp_filesystem;
include_once ABSPATH . 'wp-admin/includes/file.php';
// If for some reason the include doesn't work as expected just return false.
if( ! function_exists( 'WP_Filesystem' ) ) {
return false;
}
$writable = WP_Filesystem( false, $path );
// We consider the directory as writable if it uses the direct transport,
// otherwise credentials would be needed
return $writable && $wp_filesystem->method === 'direct';
}
Related Posts:
- Media Upload to custom database and Custom Directory
- WP_Filesystem usage within a block of code
- Does a plugin’s “main” file need to be named the same as the folder containing it?
- Symlinked plugin directory doesn’t appear in Admin
- How do I unlock a post programmatically?
- Customizing subject in comment notification e-mails
- enqueue script only if it is not already enqueue
- How can I limit functionality in one version of a plugin?
- WordPress adding tags into plugin content
- Plugin Development: WordPress processes twice on post update. How to skip process on the first?
- Execute a function using ajax
- This doesnt work for Plugin get_template_directory_uri()
- Is it possible to upload a template file to a directory that can be used by all themes?
- WordPress hook for visiting a post
- Fatal error: Class not found in
- Showing Notifications While Activating Plugin
- Workflow and best practice for documentation [closed]
- Creating a modal dialog without jQuery
- Language Translation is not working?
- What user roles should have wp_unique_post_slug_is_bad_flat_slug filter applied?
- Hidden Custom Post Type
- Is there a way to programmatically enable a plugin?
- Adding Attachment Display Settings in custom media frame
- How to include code into functions.php file via a plugin
- How can I get WordPress to save comments in markdown format?
- Simple ajax call not working in wordpress plugin
- How to save post change url youtube link?
- __callStatic method handler passed to add_action causes bug in PHP
- New databes tables with – WooCommerce – for developers [closed]
- Plugin-generated pages use Not Found or Pages Archive templates?
- Change commission_status paid when withdraw_status vendor is completed
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- Perform internal redirect in WordPress?
- How to prevent plugins from loading jQuery
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Can plugin2 uninstall plugin1 at the very beginning of plugin2’s installation?
- Basic question about accessing scripts in my plugin
- Automatically download, install and activate plugins that my plugin depends, how?
- How to create WordPress custom end point with multiple parameters?
- How to redirect to same page after form submission
- plugin dev – minimum base css specificity?
- I changed font of wordpress dashboard but it is slow!
- WordPress SVN UTF-8 issue
- Creating a functionality plugin to edit seriously simple podcasting
- Plugin temporary files and files to download via FTP
- Asynchronous request in wordpress
- change or add css to theme from plugin
- How to add credit card validation check to wordpress [closed]
- Displaying data from another database
- Every time I de-activate a custom plugin, the site encounters a critical error
- Next Previous Post in wordpress with previous / next link with title?
- How to use existing hook in twentytwelve to all theme of wordpress?
- Apply html elements in php statement
- How Can i import plugin option?
- How to Get Category Name When Export Products
- Remove List Bullets
- How to override any plugin file in the child theme
- How to set plugin auto-update Enabled by default?
- Custom plugin activation error
- How to capture hidden values with Gravity Forms
- How to translate to spanish wordpress hardcoded content/files?
- How do I stop plugins and themes from getting updated in a new plugin?
- How come W3TC is allowed to host premium code in the WordPress repo?
- Multiple image selection custom widget
- How to Create a Learning Management Plugin in WordPress to Manage Courses [LMS]
- Passing function into add_action always returns the first argument
- Paid Membership Pro displaying a user name in PHP
- Make another copy of a plugin and install it
- Store admin page into variable
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- WP Plugin CSS not being applied to page
- Overwriting Plugin’s Ajax callback function from theme
- How can I get the Post ID and Post Type within a Must Use Plugin?
- Creating Nested custom fields
- plugin not hooking to my custom hook
- Populate select option with JSON file
- Enahanced search for edit.php and custom post type
- Unable to sync woocommerce variations
- Can’t find variable is_single in my jQuery plugin
- WordPress Cron function is not working
- How to save default values into an option and delete those upon actvation and deactivation in wordpress?
- How to Add Jquery FullCalendar in wp plugin in admin
- Plugin hook breaks new WP 4.0 media library grid view?
- Ajax, jQuery and WordPress
- How to get site homepage from plugin?
- Unable to show 4 products in a row
- Is an Office a custom post type [closed]
- WordPress check box unchecked on null value ternary operator [plugin development]
- How to add image for custom taxonomy
- WordPress Hooks : Where to place callbacks that repetitively yield the same effect?
- wordpress Ajax success doesn’t return the value
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Update Content for a Custom Block Toolbar Button
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- Wrong block appender button showing
- Uncaught Error: Cannot use object of type stdClass while showing the list using WP_List_Table
- Submitting form to admin-post.php WordPress
- WordPress Throwing Deprecated Errors on its own Files
- plugin doesn’t retrieve data from database
- Display Any Field fromAdmin Panel in Frontend via Shortcode?