Title: Programmatically enable the save button
Last modified: September 19, 2024

---

# Programmatically enable the save button

 *  Resolved [matthewbaynham](https://wordpress.org/support/users/matthewbaynham/)
 * (@matthewbaynham)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/programmatically-enable-the-save-button/)
 * I’m currently writing my first WordPress plugin (React, JS) and I’m wondering
   how my plugin could enable the save button.
 * Let me explain what I mean.
 * Think about someone creating a new page or post in WordPress, then they add my
   plugin to their page or post and they publish it.
 * Then they have the page or post open and they adjust what text they have typed
   into my plugin. The problem is my plugin isn’t attached the save button for the
   page or post, so when they type away in a <input> box on my plugin, they want
   to save the page or post. But save button on the page or post hasn’t enabled.
 * An ugly work around is, if they change something on the page or post that is 
   not my plugin then the save button enables. But I don’t want to use this ugly
   work round, I want my plugin to enable to save button itself so that everything
   looks seamless to the user.
 * So how do I get my plugin to connect programmatically with the save button on
   the page or post?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/programmatically-enable-the-save-button/#post-18027652)
 * The answer may depend upon which editor the user is using. AFAIK, the Save button
   is always enabled in the block editor, at least it is on my test site. The new
   post Publish button is initially disabled until one enters a title. After publishing
   the button then reads “Save”. Both versions of the button do have a aria-disabled
   attribute whose value can be changed from true to false via JS. There may or 
   may not be more to enabling the button than that, but it’s the first thing to
   try since it’s obviously part of the solution if not the entire solution.
 *  Thread Starter [matthewbaynham](https://wordpress.org/support/users/matthewbaynham/)
 * (@matthewbaynham)
 * [1 year, 6 months ago](https://wordpress.org/support/topic/programmatically-enable-the-save-button/#post-18038433)
 * I fixed it in the end.
 * I was setting the attributes wrong. I was doing this `props.attributes.X = 7;`
   which is wrong.
 * What I should have been doing is using the `setAttributes` method `props.setAttributes({
   X: 7 });`
 * If you use the set `setAttributes` method then it’ll enable the save button.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Programmatically enable the save button’ is closed to new replies.

## Tags

 * [plugin](https://wordpress.org/support/topic-tag/plugin/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [matthewbaynham](https://wordpress.org/support/users/matthewbaynham/)
 * Last activity: [1 year, 6 months ago](https://wordpress.org/support/topic/programmatically-enable-the-save-button/#post-18038433)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
