Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
Wordpress plug-in setting not being saved if another setting is turned off

This is my very first plug-in so I'm going with trial & error, I have two fields a checkbox and a textbox, when I check the checkbox I have javascript that enable/disable the relative textbox.

What I do:

  1. Check the checkbox -> The textbox is enabled by javascript
  2. I enter a value in the textbox and save the settings — all good
  3. I remove the check from the checkbox -> The textbox is disabled by javascript
  4. At this point if I save, it strips the value of the textbox

Here are the fields definitions:

        add_settings_field(
            'stwc_ft_oosn_0', // id
            'Enable', // title
            array( $this, 'stwc_ft_oosn_0_callback' ), // callback
            'settings-admin', // page
            'stwc_ft_oosn_section' // section
        );

        add_settings_field(
            'stwc_ft_oosn_notice_1', // id
            'Text', // title
            array( $this, 'stwc_ft_oosn_notice_1_callback' ), // callback
            'settings-admin', // page
            'stwc_ft_oosn_section' // section
        );

While for the javascript it is disabling by jQuery adding disabled to the textbox, when disabled I can still see the text inside the textbox when I save the settings.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!