[wp-hackers] where does the custom taxonomy info is kept?
Haluk Karamete
halukkaramete at gmail.com
Sat Apr 7 00:41:32 UTC 2012
but registered where? in a text file?
I run the code in a stand alone php page, not in some theme's
functions.php.
the exact page goes like this,
when you say registered? I'm curious to know where it is registered,
memory?
<?php
error_reporting (E_ALL);
$full_path_to_wp_header = "F:\inetpub\wwwroot\... mypath here...
\wp-load.php";
include ($full_path_to_wp_header);
define('WP_USE_THEMES', false);
echo bloginfo();
if(0):
$arg = array('description' => "my description", 'parent' => "");
$new_cat_id = wp_insert_term("Religion", "category", $arg);
var_dump( $new_cat_id);
endif;
$labels = array(
'name' => _x( 'Genres', 'taxonomy general name' ),
'singular_name' => _x( 'Genre', 'taxonomy singular name' ),
'search_items' => __( 'Search Genres' ),
'all_items' => __( 'All Genres' ),
'parent_item' => __( 'Parent Genre' ),
'parent_item_colon' => __( 'Parent Genre:' ),
'edit_item' => __( 'Edit Genre' ),
'update_item' => __( 'Update Genre' ),
'add_new_item' => __( 'Add New Genre' ),
'new_item_name' => __( 'New Genre Name' ),
'menu_name' => __( 'Genre' ),
);
register_taxonomy('genre',array('book'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'genre' ),
));
// Add new taxonomy, NOT hierarchical (like tags)
$labels = array(
'name' => _x( 'Writers', 'taxonomy general name' ),
'singular_name' => _x( 'Writer', 'taxonomy singular name' ),
'search_items' => __( 'Search Writers' ),
'popular_items' => __( 'Popular Writers' ),
'all_items' => __( 'All Writers' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Writer' ),
'update_item' => __( 'Update Writer' ),
'add_new_item' => __( 'Add New Writer' ),
'new_item_name' => __( 'New Writer Name' ),
'separate_items_with_commas' => __( 'Separate writers with commas' ),
'add_or_remove_items' => __( 'Add or remove writers' ),
'choose_from_most_used' => __( 'Choose from the most used writers' ),
'menu_name' => __( 'Writers' ),
);
register_taxonomy('writer','book',array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'update_count_callback' => '_update_post_term_count',
'query_var' => true,
'rewrite' => array( 'slug' => 'writer' ),
));
echo "<p>Done!";
$taxonomies=get_taxonomies('','names');
foreach ($taxonomies as $taxonomy ) {
echo '<p>'. $taxonomy. '</p>';
}
?>
More information about the wp-hackers
mailing list