WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on my first plugin, and I am having some confusion. I am trying to figure out how to set a handler for a button on my plugin UI. Here is how the button is displayed:

<li class="upload-files-sec"><a id="upload_image_button" href="#" title="" data-tooltip="Upload Image" data-placement="bottom" class="upload-btn"><i class="fa fa-cloud-upload"></i></a>

The confusion is how I am supposed to link that to an action. I know using Jquery I could do something like this:

 $('#upload_image_button').click(function(e) {
//Do action here.

But what about php? If I had some php I wanted the button to execute, how would run it when the button is clicked?

share|improve this question
Some which PHP? PHP is server side language, you would need to either proceed to URL or perform Ajax request to one. – Rarst Jan 20 '14 at 0:13
Agree with Rarst. You probably need AJAX – helgatheviking Jan 20 '14 at 1:13
I figured that would be the only way to do it. Ajax it is then. – user1632018 Jan 20 '14 at 20:21

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.