Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1164864

    Hi,
    It seems that for every image a NEW page is created. I now got dozens of pages in the search results and they are not really helping with my SEO…
    Can I prevent this from happening?

    https://echomarketing.nl/kirsten-nelis/
    https://echomarketing.nl/spreektafel-echomarketing/
    https://echomarketing.nl/museum-haarlem/
    https://echomarketing.nl/childs-life/

    #1164937

    Well this is a wordpress feature –
    if you go to your media library and open one image to edit – there is an attachment page.
    If you are using Yoast SEO there is an Option to do this : redirect image attachment page to something.

    if you not using it – and you don’t like to use a plugin – you can redirect all image attachment pages f.e. to your homepage via child-theme functions.php:

    function image_redirect_attachment_page() {
    	if ( is_attachment() ) {
    		global $post;
    		if ( $post && $post->post_parent ) {
    			wp_redirect( esc_url( get_permalink( $post->post_parent ) ), 301 );
    			exit;
    		} else {
    			wp_redirect( esc_url( home_url( '/' ) ), 301 );
    			exit;
    		}
    	}
    }
    add_action( 'template_redirect', 'image_redirect_attachment_page' );
    #1164946

    PS : a lot of tools to redirect – and even Yoast SEO did it this way.
    But i try to find a solution to completely hamper creation of those attachment pages – but didn’t found one.

    #1164955

    Hi Guenni,

    Thanks you so much. I have installed Yoast plugin so now all the pages are redirected to the mediafile. Crazy feauture from WordPress I think.

    #1165063

    Hi CTBanners,

    Thanks for the update, please let us know if you should need any further help on the topic. Thanks @guenni007 for helping out as well.

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.