[SmartCrawl Pro] SmartCrawl update made images post-type visible

Dear support team,

Since the last SmartCrawl update, it seems that my images are being publicly available as a post type.
For instance : https://blog.defi-ecologique.com/renard-roux/
Would it be possible to remove this option and only keep the actual picture URL :


  • Adam Czajczyk

    Hello Greg

    I hope you're well today!

    I admit I'm a bit confused about the issue. I mean, I'm not exactly sure what the first link is/supposed to be. What should be visible there? Shouldn't that be available at all?

    If it's a post of custom post type - it was registered with "public" argument set to "false"?

    If you try to downgrade SmartCrawl Pro (you can download previous version from this link) the issue is no longer happening?

    If I was about to try to replicate this on my own setup what exactly should I do: what to register/setup/configure? I would like to give it a try so knowing what's the configuration behind would help.

    I'm just making sure that I got a full picture of the problem :slight_smile:

    Best regards,

  • Predrag Dubajic

    Hi Greg,

    Image permalink is not related to SmartCrawl or Multisite, that's actually default WP behavior.
    In SmartCrawl you can go to Advanced Tools > URL Redirection and enable "Redirect Attachments" options but this is not exactly what you're looking for.
    This will redirect images to their parent posts, so when you create a post and upload the image while in the post editor that image will redirect to that post if this option is enabled.

    If you wish to completely disable permalinks for media files then this plugin might do the trick for you:

    Best regards,

  • Predrag Dubajic

    Hi Greg,

    Do you remember how were you doing this in the past because SmartCrawl didn't had this option, it can only redirect attachments to replated posts, and that requires the image to be uploaded while editing/creating post, if you upload the image directly in Media library then it will have no redirects.

    You can try disabling SmartCrawl temporary or revert it to previous version by downloading it from plugin page here https://premium.wpmudev.org/project/smartcrawl-wordpress-seo/

    However, even if it works with previous version we would still need to know how this redirect was setup in the first place, either by custom code or some other plugin, in order to debug it further.

    Best regards,

  • Adam Czajczyk

    Hi Greg

    Would you have a short code snippet for an image.php template file that would work on any theme, and only display the image (no menus, footer or whatever) ?

    You cannot remove header/footer/menus and so on with a shortcode. That is exactly the template file task.

    You can use just a "super-blank" template though, like this:

    	<section id="primary" class="content-area">
    		<main id="main" class="site-main">
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<div class="entry-attachment">
    			<?php if ( wp_attachment_is_image( $post->id ) ) : $att_image = wp_get_attachment_image_src( $post->id, "full"); ?>
    					<p class="attachment"><a href="<?php echo wp_get_attachment_url($post->id); ?>" title="<?php the_title(); ?>" rel="attachment"><img src="<?php echo $att_image[0];?>" width="<?php echo $att_image[1];?>" height="<?php echo $att_image[2];?>"  class="attachment-medium" alt="<?php $post->post_excerpt; ?>" /></a>
    			<?php else : ?>
    					<a href="<?php echo wp_get_attachment_url($post->ID) ?>" title="<?php echo wp_specialchars( get_the_title($post->ID), 1 ) ?>" rel="attachment"><?php echo basename($post->guid) ?></a>
    			<?php endif; ?>
    			<?php endwhile; ?>
     			<?php endif; ?>
    		</main><!-- #main -->
    	</section><!-- #primary -->

    Simply create a file named "image.php", copy & paste this code into it and upload the file to your child theme.

    Note please: if you already got an "image.php" file there, make a backup of it just in case you'd need/want to restore original one.

    This should display nothing but the image, although it does include some HTML elements so you could additionally style it if necessary. It also includes "alt" attribute for image. But if you want to, the code can be "stripped down" even more to display nothing but the image itself.

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.