2

THE SETUP

I'm using WordPress 3.4.2 with Magic Fields 2 plugin. Using MagicFields2, I've added a custom field to the builtin 'page' post type. This field is called 'section_header' (which is basically just an attachment post type). My permalink structure is /%category%/%postname%/.

THE PROBLEM

Sometimes, when I try to view a page with a 'section_header' set, I get redirected to a post for the attachment instead of the post that I'm trying to view. I've noticed that the page and the attachment have the same title when this happens. It seems that the attachment is somehow getting a permalink that is superceding the permalink of the page.

A WORKAROUND

I can make the page display if I can the permalink of the page. Changing the title of the attachment in the Media Library does NOT seem to change the permalink of the attachment.

AN IDEAL SOLUTION

My ideal solution would let me change the permalink of the attachment instead. How can I accomplish this? Thanks!

  • Okay, so here's a bit of a hack. I'm sure there's a bit solution out there. I opened up the database, went to the wp_posts table and realized that the post_name column was being used to generate the permalinks. So, using phpMyAdmin, I changed the offending post_name columns and everything seems to be working. I wonder why attachments even get permalinks though? – Rustavore Dec 21 '12 at 21:30
  • It doesn't make sense for attachments to overwrite page links, or even pages that do not exist. I have same problem, cept it shows all images on page with that attachment instead. All because the attachment has a post_name that starts with the permalink and am using hierarchy pages. – Solomon Closson Aug 24 '16 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.