Add media column to edit post screen

you can create a column of post_thumbnail like so: // ADDING THUMBNAIL TO EDIT SCREEN if ( !function_exists(‘fb_AddThumbColumn’) && function_exists(‘add_theme_support’) ) { // for post and page add_theme_support(‘post-thumbnails’, array( ‘post’, ‘page’ ) ); function fb_AddThumbColumn($cols) { $cols[‘thumbnail’] = __(‘Thumbnail’); return $cols; } function fb_AddThumbValue($column_name, $post_id) { $width = (int) 100; $height = (int) 100; if … Read more

How to get an image url from media library

You have to convert attachment variable to JSON object using toJSON() . Then you can its property. use attachment = frame.state().get(‘selection’).first().toJSON(); instead of attachment = frame.state().get(‘selection’).first();

Disable edit option in Media library

There’re several filters that you can utilize: Custom column content If you got a custom column that you added with the “-filter, then you can use the manage_{$post->post_type}_posts_custom_column filter to alter the content. If you only want to target non-hierarchial post types then there’s as well the manage_posts_custom_column and for hierarchical ones, there’s manage_pages_custom_column. All … Read more

FTP files directly to Media Library wp-content\uploads

I would suggest using WP CLI for that. It’s the (in)official WordPress command line tool, like Drush for Drupal or the Symfony2 Console Component. Use the media command to handle your (future) attachments: wp media import <file> [–option=value*] * Take a look at the docs or the CLI help tool to see what options you … Read more

Disable drag and upload in Media Library

Instead of removing upload script you can make the upload error out if the user does not have admin privileges. Like this- function tomjn_only_upload_for_admin( $file ) { if ( ! current_user_can( ‘manage_options’ ) ) { $file[‘error’] = ‘You can\’t upload images without admin privileges!’; } return $file; } add_filter( ‘wp_handle_upload_prefilter’, ‘tomjn_only_upload_for_admin’ ); For other possible … Read more

Rest API rename media

After much digging, it doesn’t seem to be possible. I did craft some automation with a Node script that basically does this: Check if the name is correct. If it’s not, then download the image, upload with a new name and update the product. If everything goes smooth, delete the original image. Same is repeated … Read more

Change WordPress’ media upload URL?

It was actually easier than I thought. function route_uploads_past_cdn( $url, $path ) { $upload_paths = array( ‘async-upload.php’, ‘media-new.php’ ); if( !in_array( $path, $upload_paths ) ) { return $url; } return str_replace(‘www.’, ”, $url); } add_filter( ‘admin_url’, ‘pew_route_uploads_past_cdn’, 10, 2 ); The URL for uploading media would normally be http://www.example.com/wp-admin/media-new.php would now be http://example.com/wp-admin/media-new.php since the … Read more

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