Support

Account

Home Forums Add-ons Options Page update_value on pageload

Unread

update_value on pageload

    • oppi

    • February 8, 2019 at 7:57 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.