/* Flush rewrite rules for custom post types. */
add_action( 'after_switch_theme', 'flush_rewrite_rules' )
// do not use on live/production servers
add_action( 'init','maybe_rewrite_rules' );
function maybe_rewrite_rules() {
$ver = filemtime( __FILE__ ); // Get the file time for this file as the version number
$defaults = array( 'version' => 0, 'time' => time() );
$r = wp_parse_args( get_option( __CLASS__ . '_flush', array() ), $defaults );
if ( $r['version'] != $ver || $r['time'] + 172800 < time() ) { // Flush if ver changes or if 48hrs has passed.
flush_rewrite_rules();
// trace( 'flushed' );
$args = array( 'version' => $ver, 'time' => time() );
if ( ! update_option( __CLASS__ . '_flush', $args ) )
add_option( __CLASS__ . '_flush', $args );
}
}
register_deactivation_hook( __FILE__, 'flush_rewrite_rules' );
register_activation_hook( __FILE__, 'myplugin_flush_rewrites' );
function myplugin_flush_rewrites() {
// call your CPT registration function here (it should also be hooked into 'init')
create_catalog_taxonomies();
flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'flush_rewrite_rules' );
register_activation_hook( __FILE__, 'myplugin_flush_rewrites' );
function myplugin_flush_rewrites() {
// call your CPT registration function here (it should also be hooked into 'init')
register_cpt_tovary();
flush_rewrite_rules();
}
а мне нужно чтобы работала страница самой таксономии http://адрес_сайта/catalog