StelleDiPolvere on "How to Disable Creation of Image Attachment Pages for Uploaded Images"

ساخت وبلاگ

StelleDiPolvere
Member
Posted 18 hours ago #

Hi Guys :)
This is an unresolved question for many years...
The creation of the above-mentioned Image Attachment Page created problems to many about SEO... Someone solved With a redirect method...
But sometimes, something weird can happen:
I was uploading on the Home page an Image called Services...
Wordpress created an attachment page called mydomain.com/Services and assigned that to the image just uploaded
So when I was trying to create the actual page SERVICES i was not able to do that... and that was sad and funny :)

Anyone knows if it is possible to hack the core of WordPress to avoid the creation of pages that contain the image just uploaded?
Thank you in advance for your replies :)

If you are going through the media library to add images, then there is no "clean" way to prevent attachments. The best you can do is delete the attachment right after it is created. That would not in itself solve the attachment "stealing" your page name, but that's not a factor any more. Some revisions back the core was changed to allow different post types to have the same title slug, so both the attachment and your page can now have the same title slug.

Deleting attachments will break any theme or plugin that is relying on attachment posts for their functionality, so deleting attachment posts may not be the best approach. I'm not sure about the SEO ramifications. With many themes, I don't see how attachments would matter any. With any theme where it might matter, it's probably better to alter the theme than core code.

StelleDiPolvere
Member
Posted 11 minutes ago #

Thanks for reply bcworkz! :)
Any way to have a different attachment page permalink structure either?

For example if i'm uploading an image called services into the homepage and that will create an attachment page url at mydomain.com/services/

Is there any way to have all the attachment pages created while uploading files with a prefix?

Something that could have this kind of result
mydomain.com/img-attachments/services/

where services is the name of the image just uploaded... but at least will not take the url of a future page mydomain.com/services/

thanks :D

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 309 تاريخ : جمعه 8 مرداد 1395 ساعت: 6:46