Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Send attachment pages to the file

Each uploaded image has its own thin page (…/image-name/). This sends visitors straight to the file instead, as new WordPress sites do.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Tested with WordPress 7.1
PHP
<?php

// The same setting WordPress 6.4+ uses on new sites.
add_filter( 'pre_option_wp_attachment_pages_enabled', static fn() => '0' );

In these packs

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.