No subject
Fri Jan 29 04:20:33 UTC 2010
add_action('generate_rewrite_rules', 'my_rewrite_rules');
function my_rewrite_rules( )
{
$pages =3D get_post(get all financial terms);
foreach ( $pages as $page ) {
add_rewrite_rule('http://example.com/' . $page->page_name,
'?post_type=3Dx&p=3D' . $page->ID, 'top');
}
}
add_action('init', 'my_rewrite_flush_rules');
function my_rewrite_flush_rules()
{
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
You would just run the init action once and then hook the
my_rewrite_flush_rules() into a post_publish or update action so that
whenever a title changes or a financial term is added the rules get
updated.
On Sun, Apr 18, 2010 at 7:39 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> Thanks for the quick answer. =A0Are you saying I need to add 700+ rewrite=
rules, one for each financial term? =A0I'm hoping that won't be a requirem=
ent. =A0I'm hoping to write one rewrite rule to capture every financial ter=
m.
>
> -Mike
>
>
> On Apr 18, 2010, at 5:17 AM, scribu wrote:
>
>> Maybe something like this:
>>
>>
>>
>>
>> Not sure wether you need to have 'http://example.com/' at the beginning =
or
>> not.
>>
>>
>> --
>> http://scribu.net
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> 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