Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am writing a plugin that hides the publish box from authors, so that I can have them click on a button in a custom meta box I created, to save their post. (This is not the sole purpose of the plugin, rest, I can't share. But this step is needed to do the rest.)

I want WordPress to save the post to DB as it normally would, when I click on that button.

How do I invoke WordPress' post save action from a custom button?

share|improve this question
    
Perhaps the better option is to hook into save_post to do the things you want? –  Zogot Nov 1 '13 at 8:02
    
@Zogot: That won't help as I have to hide the publish box. Without the publish box, no publish button, no firing of save_post action. Anyway, the solution was more obvious. I should have tried it before posting here. But anyway, someone who is stuck like I was might find this helpful. I am posting the solution as the answer to this question. :) –  Kosala Indrasiri Nov 1 '13 at 8:09

1 Answer 1

up vote 0 down vote accepted

Well, the solution couldn't be more obvious.

The Add New Post screen is a one big form. Any <input type="submit"/> element you put in it will save the post.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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