Gutenberg Block: Image resolution

I was asking the same question in the comments of another question. The solution is (thanks to Кирилл-Меркушев), to get another URL from the onSelect Callback. Before I had this: function onSelectImage( media ) { props.setAttributes( { mediaURL: media.url } ); props.setAttributes( { mediaID: media.id } ); } Then I console logged the media parameter, … Read more

core/gallery get figcaption text

You’re right…the figcaptions are encoded as html in $block[‘innerHTML’]. You could do sth. like $tmpArray = explode(‘</li>’,$block[‘innerHTML’]); before your foreach loop to split the HTML string into an array that matches your gallery items and inside the loop strip_tags($tmpArray[i]); to strip away all html tags and only get the text string inside <figcaption></figcaption>. You’ll only … Read more

How to disable Media Library?

I did a googles of the issue (using ‘wordpress restrict media access’) and got this link on the first page https://www.wpbeginner.com/plugins/how-to-restrict-media-library-access-to-users-own-uploads-in-wordpress/ Which has this code // Limit media library access add_filter( ‘ajax_query_attachments_args’, ‘wpb_show_current_user_attachments’ ); function wpb_show_current_user_attachments( $query ) { $user_id = get_current_user_id(); if ( $user_id && !current_user_can(‘activate_plugins’) && !current_user_can(‘edit_others_posts ‘) ) { $query[‘author’] = $user_id; … Read more

Big file upload give HTTP error

That issue is not due to WordPress but due to your server configuration. Try increasing the PHP memory on the server as well as the max upload filesize. If you do not know how to do that please contact your hosting provider. Each server is different for that configuration therefore you won’t be able to … Read more

Add a metabox when editing a media – but only for images

gordie Here is an example of meta box for bellow possible mime types ‘image/jpeg’,’image/gif’,’image/png’,’image/bmp’,’image/tiff’,’image/x-icon’ //add meta_box for image mime types only function add_our_attachment_meta(){ $attachment_id = $_REQUEST[‘post’]; $attachment_mime_type = get_post_mime_type($attachment_id); $possible_mime_types = array(‘image/jpeg’,’image/gif’,’image/png’,’image/bmp’,’image/tiff’,’image/x-icon’); if(in_array($attachment_mime_type, $possible_mime_types)){ add_meta_box( ‘custom-attachment-meta-box’, ‘Attachment Extra Details’, ‘our_attachment_meta_box_callback’, ‘attachment’, ‘normal’, ‘low’); } } add_action( ‘admin_init’, ‘add_our_attachment_meta’ ); //callback function of custom metabox function … Read more

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