[wp-hackers] Custom post type & hierarchical
dc153464a11bcf5aeb18180db28017fb.wp-hackers at planetmike.com
Sun Aug 22 14:00:58 UTC 2010
At 10:50 PM +1100 8/22/10, Lox wrote:
>2010/8/22 Michael Clark <
>dc153464a11bcf5aeb18180db28017fb.wp-hackers at planetmike.com>
>> I added this code to the bottom of my function create_my_post_types() and
>> all is good now.
> > global $wp_rewrite;
> > $wp_rewrite->flush_rules(false);
>Do u call that function after right after register_post_type? If so it means
>it get called on every page request witch is not good, I think.
Yes, I had that right after register_post_type. I commented it out,
and the hierarchy is still working correctly. So I'd guess that set
of code only needs to be done after the first time you set up a
hierarchical set of categories.
I found this info at: http://codex.wordpress.org/Custom_Queries
" "flush" the cached rewrite rules using the
$wp_rewrite->flush_rules() or by going to settings > permalinks and
clicking "save" from within the wp-admin. Both methods force
WordPress to refresh the stored rewrite rules. "
Thanks very much, Mike
>I personally "flush_rules" only when I change the rewrite slug and it works.
Christmas Music 24 Hours a Day, 7 Days a week
"Injustice anywhere is a threat to justice everywhere."
- Martin Luther King Jr.
More information about the wp-hackers