Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there an option to create a category with a custom ID, like a custom post ID is created using the parameter import_id?

$post = array(
    'post_title'   => 'whatever',
    'post_content' => 'whatever',
    'import_id'    => 123
wp_insert_post( $post );

What I want to do is create a custom post type using wp_insert_post and will import data from a table which has a category ID attached.

So I want to create categories with custom IDs that are attached to a products table.

Right now I'm using a custom field added to categories as OLD_CATEGORY_ID and get posts against this custom field ID.

Categories are also imported to WordPress.

Is there a better way, or is this the only way? :)

share|improve this question
is my question is too difficult for experts ? or it is not clear ? :) –  Yasir Jul 7 '14 at 15:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.