#featured #images #media
Provides an instant overview of your shop's current customers and the contents of their carts.
When adding a featured image to a post, a dedicated page is created for this image which simply shows the title and the image. This attachment viewing page usually has little purpose and is not compatible with most themes. Anyone stumbling on one of these pages makes your site look weird to better to avoid access and keep things clean.
Adding this snippet to your theme’s functions.php will cause accessing an attachment page to redirect to the post it’s attached to. So http://my.blog/article/image1/
will redirect to http://my.blog/article/
.
add_action( 'template_redirect', function() {
if ( is_singular( 'attachment' ) ) {
global $post;
wp_redirect( get_permalink( $post->post_parent ) );
die();
}
} );
Posted by Berend on
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>