Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

ryanfitton/wordpress-update-acf-field-via-ajax-example

Repository files navigation

WordPress AJAX update ACF value example

This repository contains WordPress theme files which provide an example of how to update an ACF database field via AJAX. And to automatically refresh the current field value every 5 seconds.


Required

  • Ensure you have WordPress installed. Tested from WordPress 5.3.2
  • Install ACF Pro (Pro required for custom options page)
  • Upload the ACF export file acf-export-2020-03-31.json into your ACF settings

Explanation of files

  • tmpl_page_ajax.php - Page template
  • functions.php - Functions for Ajax calls
  • ajax.js - JS Ajax calls
  • libs/js.cookie.min.js - Used to set Cookies
  • libs/rsvp.min.js - Allows Promise JS to be supported in IE11

functions.php

You may already have a functions.php file in your theme, if so; do NOT overwrite this repo's file with your existing file.

Instead, copy and paste the contents of this repo's file, to the bottom of your existing theme file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published