My deleted media exists jet

I founded the solution… all it’s a problem with a JS function called “slideUp” in my ajax.js (ajax’s functions for my front-end site) I don’t know the reason, but when I try to upload or a media file, WordPress try to execute this function. I change his name and the “$” for “jQuery” and now … Read more

When I’m in post editor and click on ‘Add media’, why won’t it load the media library with this code?

The correct hook to add/remove menus in admin area is admin_menu. Also, be aware that current_user_can is intented to check user capabilities, not user roles. See current_user_can documentation and notes. add_action( ‘admin_menu’, ‘my_remove_menu_pages’ ); function my_remove_menu_pages() { $user = wp_get_current_user(); if( ! empty( $user ) && in_array( “contributor”, (array) $user->roles ) ) { remove_menu_page(‘tools.php’); // … Read more

Cant move file after media_handle_upload

You’re doing it twice – media_handle_upload is a wrapper for wp_handle_upload. Just use the former like so: require_once ABSPATH . ‘wp-admin/includes/file.php’; $id = media_handle_upload( ‘custom_upload’, $post->ID, array(), // Attachment post data overrides, WordPress will do all the grunt work by default array( ‘test_form’ => false, ‘action’ => ‘editpost’, ) ); if ( ! is_wp_error( $id … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)