This is kinda dirty, but I can find a better hook: function add_content_hash( $link ) { $link = str_replace("' title='", "#content' title='", $link); return $link; } add_filter( 'wp_get_attachment_link', 'add_content_hash' ); More Solution customization - Custom Import with taxonomies in WordPress 404 Error Problems with sCategory Permalink plugin in WordPress wp query - Total Count of Posts NOT in Selected Categories? in WordPress functions - Get urls of images in a gallery? in WordPress customization - How to use more than 256MB of memory in the admin? in WordPress Reffered: https://wordpress.org/