Help adding image upload functionality to widget

I also noticed a typo in the url media-upload.php?type=image&amp&TB_iframe=1. Maybe this is the problem. Also a working example: jQuery( ‘input[id^=my_field]’ ).live( ‘click’, function($) { formfield = $( ‘input[id^=my_image]’, $(this).closest(‘.widget’) ).attr( ‘name’ ); tb_show( ”, ‘media-upload.php?type=image&TB_iframe=1’ ); return false; } );

What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?

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 … Read more

Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions

NOTE: WordPress Rewrite API is not the same as Apache Rewrite module. WP Rewrite API doesn’t redirect a request to another URL, it used to parse current URL and fill query_vars array. The issue is in the second parameter of you add_rewrite_rule function call. It has to start from index.php? and then there should be … Read more