functions.php, create new categories with same name as custom post type
-
Hi,
I’m looking for a way to generate category names based on custom post type titles. Let’s say I add a page in my custom category with title “about”, I want to be able to hook other pages (custom post types) to this page.
I found way to generate categories (below), just can’t fetch the names of CPTs.
wp_insert_term( 'Example Category', 'category', array( 'description' => 'This is used to hook up .', 'slug' => 'example-category' ) );
cheers!
- The topic ‘functions.php, create new categories with same name as custom post type’ is closed to new replies.