• I am trying to create a click counter. So, I have created a ajax call to counter.php, where the incrementing functions will take place.

    After incrementing, I wanted to update a custom field. So, I tried to use some acf field functions. But, I get an error, Uncaught Error: Call to undefined function the_field()

    Here is the entire code.

    <?php
    $currentNumber = $_POST['currentNumber'];
    $postId = $_POST['postId'];
    
    function increment($currentNumber) {
        $newNumber = $currentNumber + 1;
        return $newNumber;
    }
    
    echo increment($currentNumber);
     
    ?>
    <p></p>
    <?php echo $postId ?>
    <?php the_field( 'coupon_users' ); ?>
    

    How to solve this error?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Call to undefined function’ is closed to new replies.