display image size in media library screen

Code based on Custom Sortable Columns add_filter(‘manage_upload_columns’, ‘size_column_register’); function size_column_register($columns) { $columns[‘dimensions’] = ‘Dimensions’; return $columns; } add_action(‘manage_media_custom_column’, ‘size_column_display’, 10, 2); function size_column_display($column_name, $post_id) { if( ‘dimensions’ != $column_name || !wp_attachment_is_image($post_id)) return; list($url, $width, $height) = wp_get_attachment_image_src($post_id, ‘full’); echo esc_html(“{$width}×{$height}”); }

How to make a script load after Custom Block is loaded in the editor?

I couldn’t find a built in ACF way of doing this. Instead, in my block’s PHP render function I added printf( “<script>window.jQuery(window).trigger(‘acf/loaded/block-name’);</script>” ); This uses jQuery as an event bus to trigger an event when the block is rendered. You might need to include a check that you’re in the admin so the event won’t … Read more

Server side validation

You can capture the form submission by creating a small plugin / or by editing your theme functions file, and you can do this using a ajax hook. In the plugin you would load this on the edit post page: jQuery(document).ready(function(){ jQuery(‘#post’).submit(function(){ var request = jQuery(this).serializeArray(); request.push({name: ‘action’, value: ‘check_some_stuff’}); jQuery.post(ajaxurl, request, function(response){ if(response.error){ response … Read more

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