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.

I know that it's impossible to have the same custom post type slug as a page.

So, I thought it might be resolved in this way:

'rewrite' => array('slug' => 'my-category/!#') for register_post_type

But I get "Page not found" every time I visit /my-category/!#/title-1

As you understand, I also have a page named "/my-category".

Is it somehow possible to resolve this conflict?

share|improve this question
3  
You have a zero acceptance rate... Doesn't really encourage other to answer this question. After you have changed the rewrite slug have you gone to permalinks settings page and hit save to flush the permalinks? –  Brady May 17 '11 at 9:45
    
@Brady I have flush_rewrite_rules(false);. Doesn't that do the same thing? –  Peter Westerlund May 17 '11 at 9:50
2  
0% accept rate, please go back to your old questions and accept some answers. –  Bainternet May 17 '11 at 10:49
    
It feels wrong to accept answers that have not solved the problems. –  Peter Westerlund May 17 '11 at 11:09
2  
then perhaps you might want to respond and clarify so that you get to a solution. If you're not willing to put in a bit of effort, then people will naturally be more reluctant to help –  anu May 17 '11 at 11:18
add comment

2 Answers

It is not impossible, but you need to be very careful to prevent conflicts. You can use my Rewrite analyzer plugin to look at your current rules.

The structure you propose, where the custom post type is stored in the URL hash (the part after the #), will not work because this part is not sent to the server. So the server will just see a request for my-category/!, not for my-category/!#/my-post. (Is it possible you switched the # and the !? The custom is to use #!/ as the hash start.)

How to solve this depends on whether you currently have verbose page rules, and this depends on your current permalink structure. Can you edit your question to add this?

share|improve this answer
add comment

What's happening is that the backend thinks that !#/title-1 is a child/next page of my-category. I've been looking at something like this today, and it just causes conflict.

I found a plugin called Custom Post Permalinks which does what I want. The only thing is is that it appears to reset itself if you add a new Custom Post Type. I'm not sure how it'll handle with your hashbang #!/.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.