add_rewrite_tag error when trying to use wp_insert_post in a third party applica
-
as the title says, i get the dreaded
Fatal error: Call to a member function add_rewrite_tag() on a non-object
when i try to use wp_insert_post in a whmcs hook. i have tried to make sure my register_taxonomy is correct and as far as i can tell it is.. here the whole thing is:
add_action( 'init', 'create_car_taxonomies', 1 ); //create three taxonomies, Makes, Classes and Features for the post type "cars" function create_car_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Types', 'taxonomy general name' ), 'singular_name' => _x( 'Type', 'taxonomy singular name' ), 'search_items' => __( 'Search Types' ), 'all_items' => __( 'All Types' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Type' ), 'update_item' => __( 'Update Type' ), 'add_new_item' => __( 'Add New Type' ), 'new_item_name' => __( 'New Type' ), ); register_taxonomy('type',array('website'), array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, "capabilities" => array('manage_terms','edit_terms','delete_terms','assign_terms'), 'rewrite' => array( 'slug' => 'business-type' ), )); // Add new taxonomy, NOT hierarchical (like tags) $labels = array( 'name' => _x( 'Features', 'taxonomy general name' ), 'singular_name' => _x( 'Feature', 'taxonomy singular name' ), 'search_items' => __( 'Search Features' ), 'popular_items' => __( 'Popular Features' ), 'all_items' => __( 'All Features' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Feature' ), 'update_item' => __( 'Update Feature' ), 'add_new_item' => __( 'Add New Feature' ), 'new_item_name' => __( 'New Feature Name' ), 'separate_items_with_commas' => __( 'Separate features with commas' ), 'add_or_remove_items' => __( 'Add or remove features' ), 'choose_from_most_used' => __( 'Choose from the most used features' ), 'not_found' => __('No features found') ); register_taxonomy('features','website',array( 'hierarchical' => false, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, "capabilities" => array('manage_terms','edit_terms','delete_terms','assign_terms'), 'rewrite' => array( 'slug' => 'feature' ), )); }
any ideas what is going on?
- The topic ‘add_rewrite_tag error when trying to use wp_insert_post in a third party applica’ is closed to new replies.