WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently my permalink setting is /paper/%postname%/.

I am developing a plugin, so the following is done during the activation.

I am programatically adding a new custom-post-type called 'meta', like this (at 'init'):

register_post_type( POST_TYPE,
  'labels' => array('menu_name' => 'meta'),
  'public' => true,
  'rewrite' => array('with_front'=>false,'slug'=>'meta','pages'=>false)

Then in the activation I programatically added a meta post, and use get_permalink(). But I get the following url:


This url leads to the 'not found' page. The correct url should be:


In the admin meta post edit page, the displayed permalink is the correct http://localhost/wordpress/meta/faq

I also tried to flush_rewrite_rules(); before I call get_permalink(). But it didn't work.

Does anyone have any idea?

share|improve this question
Are you able to consistently reproduce this by creating more posts and getting wrong results from get_permalink()? – soulseekah Mar 13 '12 at 11:15

At what stage are you registering your post type? If it's going right in the admin I'm thinking that you might be registering your post type too late. It has to be done on init to work...

Also, removing the 'pages'=>false might just fix it.

share|improve this answer
yes it is done in init like add_action('init', 'set_post_type_meta');, NOT inside the activation function. I tried removing it but it didn't work either. – lulalala Sep 29 '11 at 8:48
@lulalala Try adding a flush_rewrite_rules(); after registering your custom post type. – Michael Ecklund Jun 28 '12 at 4:29

Your Answer


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.