dmchale / disable-json-api

Public repo for the "Disable REST API" WordPress plugin, currently with 90,000+ active installs in the wordpress.org repository
10 stars 9 forks source link

Why @submit_button() ? #6

Closed tangrufus closed 7 years ago

tangrufus commented 7 years ago

Any reason to use @?

https://github.com/dmchale/disable-json-api/blob/f907172e83021f622b3007ef363bc5fa6c610cdc/admin.php#L76

dmchale commented 7 years ago

I used it here only because I've seen it used by many other developers, so I chose to follow their lead. I didn't tear things apart to find out "why" but assumed there must be SOME reason that other devs choose to suppress errors from that function :)

tangrufus commented 7 years ago

Checking the source code of submit_button and get_submit_button, I don't think we are expecting any errors here.

Suppressing unexpected errors is not a good idea.

Besides, WordPress v4.8.1 itself don't use @submit_button nor @get_submit_button.

dmchale commented 7 years ago

After doing more homework, I confirmed the same... seems like @submit_button() is a legacy copy/paste issue that just sort of exists out there for no real reason. Removed: https://github.com/dmchale/disable-json-api/commit/e9501431844c79042ea62dbd947f45b29b056bcd