0

In the wordpress dashboard/admin area of a page. I add this event handler to jQjuery. When I click the button with the name btnSave the content-editor replaces it's content to the text wow (It's not my final intention to just replace it with text wow but that does not matter for the question I'm asking).

 $('body').on('click', 'div input[name="btnSave"]', function() {
     $('textarea#content').html('wow');
 });

I'm using the default theme. Is textarea always accesible throught textarea#content in wordpress dashboard for a specific page? (when logged in) (Or does/may it differ between different themes?)

Or is there are more "safe" way of doing this? (100% safe that it will work unregardlessly of theme and wordpress version)

I'm creating a plugin with some settings for a specific page. When I change settings I want those settings to reflect directly in the content-editor (without saving anything).

0

If someones stumbles on the same question. The short answer is yes.

I've tested around ten totally different themes and I didn't have any issue with any of them. I have only tested when using "Classic editor" (not Guthenberg) so it may differ if you use Guthenburg because it's a another way of retrivering info etc.

I cannot say yes with 100% (because I've "only" tested with 10 different themes) clarity but 99,9% probably :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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