Support

Account

Home Forums Backend Issues (wp-admin) Auto Populate Fields value from backend.

Helping

Auto Populate Fields value from backend.

  • hi

    i’m using this code to get value of the fields like AppTitle based on the ID i type in APPID field.

    and when i add an app id value and save my post as draft the app-title field will automatically gets the correct value from my api.

    the problem is that in some cases i need to change some value that comes from api manually and my code won’t let me change the value of for example app title manually.

    cause it’s on acf save post hook.

    is there any way i could add a button next to app id field and when i click on that button all fields like app title populated with their value and if its needed i change some of the values that comes from api and then save the post ?

    function my_acf_save_post( $post_id ) {            
    	
       // my api call here 
     			
       update_field('app_title', $data['AppName'], $post_id);
    	          
    }
    
    add_action('acf/save_post', 'my_acf_save_post', 20);
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Auto Populate Fields value from backend.’ is closed to new replies.