Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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!

share|improve this question
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.