Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @sacconi

    This code seems to provide a functionality for real-time saving of custom field data in the WordPress admin area without requiring a full page refresh and it seems correct to me.

    It is recommended to use the above code in a child theme’s functions.php file. This ensures your changes aren’t overwritten when the parent theme updates or if you want this function to work even when you change the theme, create a custom plugin file for this.

    And Yes, you can have a single JavaScript code block that works on many custom fields simultaneously, provided they share a common characteristic, such as a class, a parent container, or a naming convention.

    Regards

    Thread Starter sacconi

    (@sacconi)

    I put the 2 blocks of code in function.php and the site got broken…

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

The topic ‘Adding JavaScript in order to save data more quickly’ is closed to new replies.