• Resolved Rneo83

    (@rneo83)


    How to show actual category ID? In product page.

Viewing 1 replies (of 1 total)
  • Plugin Author ndre

    (@ndre)

    You can show the category ID with the following code:

    add_action( 'single_product_end', 'my_show_category_id');
    
    function my_show_category_id($post) {
       $terms = wp_get_post_terms( $post->ID, 'al_product-cat', array( "fields" => "ids" ) );
       if (!empty($terms[0])) {
          echo intval($terms[0]);
       }
    }

    This will show the first product category ID on the bottom of the product page.

Viewing 1 replies (of 1 total)
  • The topic ‘How to show actual category ID’ is closed to new replies.