Return to Snippet

Revision: 16058
at July 24, 2009 13:42 by pdswan


Initial Code
function extend_date_archives_flush_rewrite_rules(){
	global $wp_rewrite;
	$wp_rewrite->flush_rules();
}
add_action('init', 'extend_date_archives_flush_rewrite_rules');

function extend_date_archives_add_rewrite_rules($wp_rewrite){
	$rules = array();
	$structures = array(
		$wp_rewrite->get_category_permastruct() . $wp_rewrite->get_date_permastruct(),
		$wp_rewrite->get_category_permastruct() . $wp_rewrite->get_month_permastruct(),
		$wp_rewrite->get_category_permastruct() . $wp_rewrite->get_year_permastruct(),
	);
	foreach( $structures as $s ){
		$rules += $wp_rewrite->generate_rewrite_rules($s);
	}
	$wp_rewrite->rules = $rules + $wp_rewrite->rules;
}
add_action('generate_rewrite_rules', 'extend_date_archives_add_rewrite_rules');

Initial URL

                                

Initial Description

                                

Initial Title
Date Based Category Archives for Wordpress

Initial Tags
php, wordpress, category

Initial Language
PHP