Skip to content

Instantly share code, notes, and snippets.

@Wp1stop
Wp1stop / README.md
Created April 15, 2022 04:35 — forked from theJasonJones/README.md
Auto Populate Wordpress ACF Repeater values

Add default values to ACF Repeater Fields

I came across this solution when I had about a ton of posts (200+) with values in various PDFs. I didn't want to have to spend time filling out the same values over and over again.

Walkthrough

This case is pretty straight forward; I have one repeater field field_123a56b7cb890 that has a text fields inside it (field_588a24c3cb782). I haven't tried any other types like post objects or radio buttons, but I'm sure it can be done.

Step 1. Hook into acf/load_value on your repeater field. You can use type/key/name as desired here.

@Wp1stop
Wp1stop / add-to-cart.js
Created January 19, 2018 22:27 — forked from michaelaguiar/add-to-cart.js
Woocommerce: Update Mini Cart on Ajax
// Update Mini Cart
$.post(
woocommerce_params.ajax_url,
{'action': 'mode_theme_update_mini_cart'},
function(response) {
$('#mode-mini-cart').html(response);
}
);
<?php
/**
* Handle file uploads via XMLHttpRequest
*/
class qqUploadedFileXhr {
/**
* Save the file to the specified path
* @return boolean TRUE on success
*/
#!/bin/sh
# specify the target URL
url="http://www.example.com"
# spoof a user-agent if you need to
userAgent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36"
# specify the payload data
data="id=12345"
/**
* Limit User to One Submission Per Time Period
* http://gravitywiz.com/2012/04/25/limit-user-to-one-submission-per-time-period/
*/
// update the "5" to your form ID
add_action('gform_pre_render_5', 'gform_limit_submissions');
function gform_limit_submissions($form){
global $wpdb;