Is wp_read_audio_metadata() function deprecated?

wp_read_audio_metadata() is not deprecated. It’s located in /wp-admin/includes/media.php, which is not loaded on the front end, hence the error your’re getting. You are using the function correctly. You can make wp_read_audio_metadata() available by including wp-admin/includes/media.php before calling the function, e.g.: require_once( ABSPATH . ‘wp-admin/includes/media.php’ ); $audio_file_path = get_attached_file( 1821 ); // example attachment ID var_dump( … Read more

Disable media library tab for non admins in uploader screen

This function will not show media library tab in upload screen function remove_medialibrary_tab($strings) { if ( !current_user_can( ‘administrator’ ) ) { unset($strings[“mediaLibraryTitle”]); return $strings; } else { return $strings; } } add_filter(‘media_view_strings’,’remove_medialibrary_tab’); I found out that switching to media library tab actually call this ajax action query-attachments. So i added another callback function to this … Read more

How to call WP3.5 Media Library manager?

From the article How to use WordPress 3.5 Media Uploader in Theme Options (by codestag.com), as seen in Using the WordPress 3.5 Media Uploader within plugins (by mikejolley.com). Mike Jolley’s article has quite some nice tricks. Important note: if the page where the uploader is going to be used doesn’t already have all media JS … Read more

Is it possible to trigger some JavaScript when Media Popup is opened?

You can use several event handlers. frame.on(‘open’,function() { // Do something }); frame.on(‘close’,function() { // Do something }); frame.on(‘select’,function() { // Do something }); Where frame is a reference to wp.media() frame = wp.media(); frame.on(‘select’,function() { // Do something }); Full example Script en-queued with jQuery and media editor as dependencies. function media_script_enqueue() { wp_enqueue_script( … Read more

Large Uploads in WordPress

70-80MB is really not that large. Easily handled by the Flash uploader if your server is properly configured. Hell, I have a 2 gigabyte upload limit on my site. 🙂 When they’re writing the new “post”, they just click the add media button above the toolbar and upload it. It gets saved as an attachment … Read more

How do I link directly to uploaded files?

If I upload the file to WordPress’ upload directory through FTP, I don’t see the file show up in my media (in WP-admin) Try to avoid directly uploading via FTP. WordPress doesn’t scan your uploads folder for new images. Instead, use the built-in media uploader within WordPress to upload images. WordPress will automatically place them … Read more

How to set an upload directory for each media type?

[More info added]. See below the code. //~ change upload dir add_filter(‘upload_dir’, ‘choose_upload_dir’); //~ upload image $upload = wp_handle_upload( $_FILES[‘your_form_input_name’], array(‘test_form’ => false) ); //~ change upload dir back remove_filter(‘upload_dir’, ‘choose_upload_dir’); function choose_upload_dir($upload) { //~ your file to upload $file_type = $_FILES[‘your_form_input_name’][‘type’]; //~ switch between file types switch($file_type) { //~ if type is ‘png’ then … Read more

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