I am using the example at populate dropdown wordpress form from database custom table.

I understand the code but I do not know how to execute it. This code should be executed whenever a new Post is started. I am trying to populate two dropdowns.

Edit: I have given this another think. I think the code should go in the Front Page. Then it is called only when the front page shows. Thanks...Dan'l

  • You would put the code for the dropdown in the place you want to put the dropdown. However, it sounds as if you have found the final piece of a puzzle without identifying the foundations. When you say whenever a new post is started, what do you mean? That could mean a number of things, in a number of places
    – Tom J Nowell
    Commented Mar 9, 2020 at 12:56

1 Answer 1


Thing is, the code can go to many places. For me, personally, is to develop own plugin and add code there.

If you need to something execute at certain point, use add_action hook.

From what you wrote, this question might be helpful: add_action hook for completely new post?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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