Remove link from post images

This should do the trick. The filter will check for images and removes the a (link) tag. Just add it to your theme’s functions.php: add_filter( ‘the_content’, ‘attachment_image_link_remove_filter’ ); function attachment_image_link_remove_filter( $content ) { $content = preg_replace( array(‘{<a(.*?)(wp-att|wp-content/uploads)[^>]*><img}’, ‘{ wp-image-[0-9]*” /></a>}’), array(‘<img’,'” />’), $content ); return $content; }

Featured image fallback link to permalink

I have updated your code so that the fallback image has post permalink. I hope this helps: if ( has_post_thumbnail() ) { echo ‘<a href=”‘ . get_permalink($post->ID) . ‘” >’; the_post_thumbnail(); echo ‘</a>’; } else { echo ‘<a href=”‘ . get_permalink($post->ID) . ‘” ><img src=”‘. get_stylesheet_directory_uri() . ‘/img/fallback-featured-image.jpg” /></a>’; }

Frontend Post – Allow Only Image File Upload

You can check mime type of uploaded image before upload to media. Add mimeTypes in $allowmimeType which you want to allow. then check uploaded files mimetype $fileMimeType. If not found in allowed mimetype then return false. // Insert Attachment function insert_attachment($file_handler, $post_id, $setthumb=’false’) { if ($_FILES[$file_handler][‘error’] !== UPLOAD_ERR_OK){ return __return_false(); } # uploaded file type … Read more

How do i show wordpress attachments from current post?

Your code and description seem to refer to the previous/next attachment navigation. That code is intended to display previous/next attachment navigation, and that’s exactly what it’s doing. If you want to display all attachments: Within the Post Content, use the shortcode Programmatically, in the template file, use e.g. get_posts(), combined with e.g. wp_get_attachment_image(): <?php global … Read more

Photo gallery with Featured Images

$query = new WP_Query(array(‘posts_per_page’ => 6, ‘meta_key’ => ‘_thumbnail_id’)); while($query->have_posts()) : $query->the_post(); the_post_thumbnail(); endwhile; This code gets 6 latest posts which have featured image available & show those 6 images on the page. It will skip those posts where there is no featured image set even if they are newer. This will probably get you … Read more