[wp-hackers] Need Custom Post Type Rewrite Help, Please

Mike Schinkel mikeschinkel at newclarity.net
Sun Apr 18 10:37:23 UTC 2010


So adding this mostly worked:

	$wp_rewrite->use_verbose_page_rules = true;

BTW, this also work, in it's entirety (note the last line is different from what you suggested, i.e. no domain, only path):

	global $wp,$wp_rewrite; 
	$wp->add_query_var('financial-term');
	$wp_rewrite->add_rewrite_tag('%financial-term%', '([^/]+)','financial-term=');
	$wp_rewrite->add_permastruct('financial-term', '%financial-term%');
	$pages = get_pages();
	foreach ( $pages as $page )
    		$wp_rewrite->add_rule("$page->post_name/?","index.php?post_type=page&p={$page->ID}",'top');

Only problem is, in either case, now it calls single_template instead of page_template.  Go figure.

-Mike


On Apr 18, 2010, at 6:22 AM, scribu wrote:

> Oh... Right, try triggerring add_verbose_rules somehow, so you don't have to
> add the page rules yourself.
> 
> 
> On Sun, Apr 18, 2010 at 1:20 PM, Mike Schinkel
> <mikeschinkel at newclarity.net>wrote:
> 
>> I get a 404 error on the "about" page.
>> 
> 
> 
> -- 
> http://scribu.net
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list