Home Forums Backend Issues (wp-admin) Create dates on acf repeater rows possible ?


Create dates on acf repeater rows possible ?

  • This seems impossible out of the box but I’m hoping someone can prove me wrong !?

    Basically I have an important ACF field that contains a repeater row. What needs to happen is that every day I need to run a routine that checks through all posts and the properties for this specific field.

    If any individual repeater row within the field is older than 30 days I need to delete the row within the repeater leaving others intact.

    My somewhat of a hack fix for this is to add a createdate field to the wp_postmeta table because unfortunately the table doesn’t have date stamps as standard. If it did then I believe I could easily run an sql command deleting entries from it, knowing that this is where ACF stores its data.

    However aside from this wp table modification, does anyone have a bright idea how I could do this?

  • I’ve answered this myself. I’ve used the hidden field addon plugin ( If you set it to a width of 0.1% and don’t give it a title it appears very subtle within a repeater element and isn’t an eyesore.

    I’ve then used the append JS ACF hook to capture new repeater rows being added and I then populate this field with a unix datetime stamp!

    // catch newly created repeater rows... 
    acf.add_action('append', function( $el ){
    	var unixdatetime = Math.round((new Date()).getTime() / 1000);
    	var $row = $el.closest('.acf-row');       
    	$row.find('.acf-field-5ad749e45b14f input').val(unixdatetime);
    	console.log("set date time stamp: "+unixdatetime);
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Create dates on acf repeater rows possible ?’ is closed to new replies.