Create new folder and upload files to custom folder via wp_handle_upload

This isn’t a working example but should help, Use wp_upload_dir() to define the default uploads folder and append a username to it using wp_get_current_user. $wp_upload_dir = wp_upload_dir(); $user_folder = wp_get_current_user(); // The actual folder $custom_upload_folder= $wp_upload_dir[‘basedir’] . $user_folder->display_name; //make the dir mkdir($custom_upload_folder); You would need to employ security and code that checks for errors/user capabilities … Read more

My custom widget won’t stay in the widget area after I refresh the widget page

ID Base should be passed to WP_Widget class constructor as shown in the following code, You have passes wrong id “example-widget” which does not match with “id_base”, also don’t add spaces in id base. Replace MY_Widget() function with following modified function and it will work. function MY_Widget() { $widget_ops = array( ‘classname’ => ‘example’, ‘description’ … Read more

Transient Loop Not working as expected

What is the code on line 3645? You didn’t specify. From what I see in your code, $transient_name should be something like “_my_post_list_transient” – a string. If $transient_name is returning a post object, then your call to this function may be the problem.