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

Prevent large image uploads

You have a few different solutions available here: Automatically scaling down If you just do not want to store huge amounts of image data on your webspace, I’d recommend the Plugin Imsanity. This automatically scales down the uploaded images, even if they are too big. Forbid large uploads In this case the user has more … Read more

Remove P tags from images

1) Filter wpautop() with ACF: function filter_ptags_on_images($content) { $content = preg_replace(‘/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU’, ‘\1\2\3’, $content); return preg_replace(‘/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU’, ‘\1’, $content); } add_filter(‘acf_the_content’, ‘filter_ptags_on_images’); add_filter(‘the_content’, ‘filter_ptags_on_images’); If you have both of those try checking with a later priority on the add_filter. It’s possible the theme or plugin or acf is overriding you…. add_filter(‘acf_the_content’, ‘filter_ptags_on_images’, 9999); … Read more

Img Src File path issue

No your file path setup is correct, you need to provide the absolute path in you img src for images to load on other pages as relative path would change to, http://yourwebsite.com/page/wp-content/themes/blankslate/images/morebutton.png and instead it should be http://yourwebsite.com/wp-content/themes/blankslate/images/morebutton.png So you should define a constant in your function.php for path to image directory, and then use … Read more

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