Support

Account

Home Forums Backend Issues (wp-admin) Dynamic choice select on post object selects Reply To: Dynamic choice select on post object selects

  • Ah, the late timing of the prepare_field filter seems to make this possible via the $field[‘value’] key

    function preselect_an_option( $field ) {
       
        if (isset($_GET['book_author'])){ // or however you get the value dynamically
            $field['value'] = $_GET['book_author']; // this is where it gets selected!
        }
        return $field;
             
    }
    add_filter('acf/prepare_field/name=book_author', 'preselect_an_option');