This question already has an answer here:

How can I force the user to first choose a category product before continuing to the editor when creating a new product?

I found a successful solution but it is working for posts not products. Force category choice before creating new post?

What I did: I changed the following code :

  $post_type = 'post';
    if ( isset( $_REQUEST['post_type'] ) ) {
        $post_type = $_REQUEST['post_type'];

    // Only do this for posts
    if ( 'post' != $post_type ) {


$post_type = 'product';
if ( isset( $_REQUEST['post_type'] ) ) {
    $post_type = $_REQUEST['post_type'];

// Only do this for products
if ( 'product' != $post_type ) {

It worked, But it Still listing post categories not product categories.

marked as duplicate by Dave Romsey, cjbj, fuxia Feb 26 '17 at 2:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You can resolve this issue by simply specifying the taxonomy you want to display.

$dropdown = wp_dropdown_categories( 
    'name' => 'category_id[]', 
    'hide_empty' => false, 
    'echo' => false,
    // Set taxonomy for product categories.
    'taxonomy' => 'product_cat',
  ) );

Before posting here, you should at least do some research on how this code snippet worked for 'post', you would've found your answer yourself.

Reference :

  • Thank you so much, the product categories loaded successfully. but when I select a category and press Continue, I found that the selected category isn't checked !!! – hazemhazem Feb 13 '17 at 15:31
  • You will need to use the get_default_post_to_edit to set default after the user selects the category. – devkabiir Feb 13 '17 at 16:00
  • Your original question was about product categories not being displayed. That is what I answered. Here at WordPress Stack Exchange we discourage 'do it for me' type of questions. You should try before you ask. – devkabiir Feb 13 '17 at 16:02
  • I tried for two days, but I didn't get anything. I'm not a developer. – hazemhazem Feb 13 '17 at 16:09
  • I did add get_default_post_to_edit( 'product'); but still not working. – hazemhazem Feb 13 '17 at 16:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.