Media Library not showing images properly

Got home now and I had a proper look at your included image. The problem that you are experiencing is related to the naming of your images. Images, like any other files should not contain special characters as these special characters are not treated the same by operating system/file managers etc Currently, from your image, … Read more

Media gallery: remove “insert into post” button keeping “Insert gallery” button

I solved in this way add_filter( ‘media_view_strings’, ‘my_media_view_strings’); function my_media_view_strings($strings) { if (!current_user_can(‘edit_theme_options’) ){ $strings[“insertMediaTitle”] = “”; //Don’t unset! unset($strings[“insertFromUrlTitle”]); } return $strings; } //Media button click open “Create Gallery” add_action( ‘wp_enqueue_media’, ‘openGallery’ ); function openGallery(){ if (!current_user_can(‘edit_theme_options’) ) add_action( ‘admin_print_footer_scripts’,’openGallery_script’, 999); } function openGallery_script(){ ?> <script type=”text/javascript”> jQuery(function(){ jQuery(“.insert-media”).click(function (event){ var options = { … Read more

Allow only attachment uploaded to current post

Maybe I was over thinking, but the solution is easier than I thought. I just have to limit the event handler to some element, so other unrelated ones will not trigger the handler. In this case, .media-modal is the overall parent of the media library element, so I am specifying this extra selector to the … Read more

How add a group by to the query used by the media library?

I found a solution; use pre_get_posts: add_action( ‘pre_get_posts’, ‘modify_attachments’ ); function modify_attachments( $query ) { if ( is_admin() && strpos( $_SERVER[ ‘REQUEST_URI’ ], ‘admin-ajax.php’ ) !== false ) { add_filter( ‘posts_groupby’, ‘group_attachments’ ); } return $query; } function group_attachments( $groupby ) { $groupby .= ” guid”; return $groupby; }

Sorting Media Library by Author Name

Order by the author’s display name: This is most likely by design, because the only information about the author in the wp_posts table is the author ID. We can join it with the wp_users table to get more information about the user and then modify the order accordingly. Here’s an example how we can order … Read more

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