replace wp_get_attachment_image with my own function

There is a filter, wp_get_attachment_image_attributes, for the image attributes– a well designed one too. function alter_att_attributes_wpse_102079($attr) { $attr[‘data-src’] = $attr[‘src’]; return $attr; } add_filter( ‘wp_get_attachment_image_attributes’, ‘alter_att_attributes_wpse_102079’); That will add the data-src attribute. That looks like what you need. You could add more attributes, or alter the existing onese, if you need.

Remove title attribute from images

I would strongly discourage this. A better, more sustainable practice would be to educate your clients on the value of the title attribute and teach them how to use it properly. Simply removing it is putting a bandage on the symptom, not combating the disease. However, if you do want to remove the attribute anyway, … Read more

Default Image Link Removal

This is not able to be changed through a filter. In WordPress 2.9.2 and lower, the setting can be changed in /wp-admin/options.php. The image_default_link_type field is set to “file” by default. If you set it to “none”, then scroll to the bottom and save, it will disable media links. This option has been removed from … Read more

Modifying an uploaded image with ‘wp_get_image_editor’ and ‘wp_handle_upload_prefilter’

I decided to approach it differently. Instead of hooking into ‘wp_handle_upload_prefilter’ and tampering with the $file variable I decided to do the resize after the file is uploaded and after I get the attachment id like this: public function resize_attachment($attachment_id, $width, $height) { // Get file path $file = get_attached_file($attachment_id); // Get editor, resize and … Read more

Always use for post images

You can try the image_send_to_editor filter: /** * Wrap the inserted image html with <figure> * if the theme supports html5 and the current image has no caption: */ add_filter( ‘image_send_to_editor’, function( $html, $id, $caption, $title, $align, $url, $size, $alt ) { if( current_theme_supports( ‘html5’ ) && ! $caption ) $html = sprintf( ‘<figure>%s</figure>’, $html … Read more

show author image in posts

I know this is old, but I just came across it shortly before I came across the solution. To display the author image inside the loop, just use this code: <?php echo get_avatar( get_the_author_meta( ‘ID’ ) , 32 ); ?> Where ’32’ is the size of the image. If it’s outside the loop, then just … Read more

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