Disable Media Pages


Completely disable «attachment» pages created by WordPress.

By default, WordPress creates a page for each of your attachments. This is can be undesirable because of two reasons:

Search engine optimization

Las páginas de adjuntos no tienen ningún contenido, excepto una imagen, por lo que proporcionan poco valor y pueden afectar negativamente a tu SEO.

Reserved slugs

Accidentalmente, las páginas de adjuntos pueden reservar slugs en tu sitio. Digamos que subes una imagen llamada contacto.jpeg, una página adjunta https://ejemplo.com/contacto es creada automáticamente. Después, si intentas crear una página llamada «Contacto», la URL para esa página será https://ejemplo.com/contacto-2, lo cual no es bueno.

Cómo funciona

This plugin works by automatically setting all attachment slugs to an unique id, so they won’t conflict with your pages. If an attachment page is accessed, the plugin will set a 404 status code and display the «page not found» template.

También puedes manipular cualquier slug de los medios existentes, para que no causen ningún problema en el futuro.


Special thanks to Greg Schoppe for his research and inspiration that helped a lot with developing this plugin.

Support the plugin

Maintaining a WordPress plugin is a lot of work. If you like the plugin, please consider rating it on WordPress.org. You can also support me on GitHub sponsors. Thank you!

If you are interested, you can also check out my other WordPress plugins:


  1. Instala el plugin desde tu escritorio de WordPress
  2. Activa el plugin Disable Media Pages a través de la página de administración de plugins
  3. A partir de ahora, las páginas de medios serán desactivadas y los nuevos elementos de medios subidos a la biblioteca tendrán slugs con un ID único.


¿Cómo manipular los slugs de los medios existentes?

Ve a la página de plugins, desplázate a «Disable Media Pages» y haz clic en «Ajustes». Esto te mostrará un asistente para manipular los slugs de los medios existentes.

¿Por qué no usar simplemente Yoast SEO? Tiene una característica para redirigir las páginas de medios a la principal

En primer lugar, no todo el mundo usa Yoast SEO. Más importante aún, mientras que Yoast SEO puede corregir el problema del contenido duplicado, no ayuda con el problema de los archivos de medios que reservan los slugs para las páginas.

What if I want to redirect attachment pages to parent page instead?

Instead of displaying a 404 HTTP error, some people recommend you to redirect attachment pages to the parent page instead. I think this can be a good short-term solution if the attachment pages have been indexed by Google and you want to preserve SEO ranking for these URLs. There’s a plenty of plugins on the plugin directory that let you to do that. In my opinion returning the 404 error is the correct long-term solution and if you are launching a new site, it’s best to simply disable these pages so they won’t ever end up in Google index.

What kind of unique id is used?

The unique id is an UUIDv4, without dashes.

Can I restore the attachment page slugs after mangling?

Yes, this functionality is available in version 1.1.0

Can I find this plugin on GitHub?

Yes, check out the GitHub repository.


5 de agosto de 2021
This plug-in does what it needs to do and it does it perfectly. It prevents conflicts between attachment pages and other permalinks while allowing media to be opened directly. Yes, this feature is built into SEO optimization plugins. However, not all sites need or want the added bloat of SEO optimization plugins to perform this task. Thank you @joppuyo for creating this plugin.
19 de mayo de 2021
EVERY single article I've looked at after searching for a way to solve this issue has said to install an SEO plugin and just redirect the permalink to the original file. That doesn't solve the underlying problem. I have a logo file called square.png, that is tucked away nicely in the wp-content folder as it should be. But WordPress (in its infinite wisdom) decides that people want to see a page of information about the file when they visit example.com/square. What if I want to put a page at that url? Even if I use an SEO plugin to redirect it, that url is still taken and the page I create is put at example.com/square-2. Wordpress doesn't allow you to edit the permalink of an attachment or put them in their own namespace like example.com/attachment/square. This plugin solves ALL of that trouble, all of the permalinks now refer to the url of the actual file, with the url of the attachment page renamed to a long random alphanumeric string so it won't conflict with anything.
18 de febrero de 2021
Media attachments URL are a real problem in WordPress. Some developers of plugins have decided to redirect ALL media attachments to the homepage. They are wrong. One of my websites has been already penalized for such a behavior. Some developers of plugins decide to redirect media attachments to the parent page. They are wrong too. If you upload a picture to WordPress, and then if you go to the media library and click on view attachment page, you will be able to see the attachment page because it has no parent. It is normal since you didn't added the picture to a post or a page. When the picture isn't listed on a post or page, it still has an attachment page. So, some of you may say: "but I think that google will never find it". You are wrong! In fact, because of autocomplete function of wordpress and other auto guessing features of plugins, Google may follow a Url and end up on the attachment page. This plugin destroys media attachment by returning a 404. That's the best. Using this technique, it ensures that you will never get penalized because of the media attachment. The 404 is the best approach. I looked into the redirections when googlebot visited a Attachment URL using Yoast. GOoglebot expects a HTML page at the end of the redirection. However, Yoast redirects to an image. Let me explain. I saw that after hitting the attachment page and being redirected to the URK (for instance: /jojo.jpg). Google sends a HTTP request: "accept: text/html" in other words, google thinks that jojo.jpg is a HTML file. It is normal because the source is a HTML page (the attachment page). Googlebot does not like this redirection between it transits from a HTML page to a media file (for instance an image). Then, Googlebot is lost and will come back several time, looking for a text/html rather than a image/jpeg PLus, this plugin is super easy to use. You install it, activate it and it works out of the box.
Leer todas las 5 reseñas

Colaboradores y desarrolladores

«Disable Media Pages» es un software de código abierto. Las siguientes personas han colaborado con este plugin.


«Disable Media Pages» ha sido traducido a 6 idiomas locales. Gracias a los traductores por sus contribuciones.

Traduce «Disable Media Pages» a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

1.1.2 (2022-01-19)

  • Fix: Remove debugging statements
  • Fix: Fix typo in readme

1.1.1 (2022-01-06)

  • Fix: Minor fix to the icon

1.1.0 (2022-01-06)

  • Feature: Add a tool for restoring media slugs back to the original ones
  • Feature: Add status page for the plugin which tells you if you have attachments without unique ids
  • Fix: Add menu for the plugin under Settings on the WordPress dashboard
  • Fix: Update plugin icon

1.0.8 (2021-07-24)

  • Fix: Bump supported WordPress version to 5.8
  • Fix: Update dependencies

1.0.7 (2021-06-14)

  • Fix: Update dependencies
  • Fix: Update FAQ
  • Fix: Tweak icon

1.0.6 (2021-06-09)

  • Fix: Fix issue with deployment

1.0.5 (2021-06-09)

  • Fix: Bump tested up to @ 5.7
  • Fix: Add acceptance tests

1.0.4 (2021-01-02)

  • Cambio: Añadido un icono

1.0.3 (2020-12-31)

  • Corrección: Cambiada correctamente la versión necesaria de WordPress a la 5.0
  • Corrección: Optimizado el cargador automático

1.0.2 (2020-12-31)

  • Cambio: Versión en el directorio de plugins de WordPress
  • Cambio: Cambios en la estructura interna del plugin
  • Corrección: Hacer traducible el plugin
  • Corrección: Cargar JavaScript y CSS solo en la página del plugin

1.0.1 (2020-12-19)

  • Corrección: Compatibilidad con WordPress 5.6, gracias a @tnottu

1.0.0 (2020-09-26)

  • Versión inicial