Support

Account

Home Forums Add-ons Options Page update_value on pageload

Unread

update_value on pageload

  • There is this case where i hook into “update_value” to filter an array of post-IDs and save those new values on an acf options page.

    function acf_save_bestseller( $value, $post_id, $field  ) {
    
    	$new = [];
    	foreach ($value as $id) {
    		if (get_field('bestseller', $id) == "Ja")
    			$new[] = $id;
    	}
    
    	return $new;
    
    }
    add_filter('acf/update_value/name=prod_bs', 'acf_save_bestseller', 10, 3);

    This is working fine, but should be running while loading this specific options page as well, because it increases the usability for the user while working with that page. As of now the user has to click the update button once to filter out potential IDs that got obsolete.

    Is there some acf init hook with that specific data available, so i can filter that array of IDs?

Viewing 1 post (of 1 total)

The topic ‘update_value on pageload’ is closed to new replies.