How can I get an array with Order IDs by Product ID?

I mean receive all orders where specific product is presented.

I know how to do this by MySQL, but is there a way to do this by WP_Query function?

Read more here: Get all Orders IDs from a product ID


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: