Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Gregory

Export File Name only shows ID # not actual text name

I am wanting to export the list of data from the table on the post list. I have a column that is an ACF field for an file. In the list on the admin side it shows the actual file name but when I export the list the text file name is replaced with its ID.

Any way to change this to export to correct thing?

4 years, 11 months ago
Stefan van den Dungen Gronovius
Developer

Hello,

The following snippet will give you the file name in the exported file.

/**
 * @param $value  string
 * @param $id     int
 * @param $column AC\Column
 */
function ac_export_acf_file_url( $value, $column, $id ) {
	if ( $column instanceof ACA\ACF\Column\Post && 'file' === $column->get_acf_field_option( 'type' ) ) {
		$value = strip_tags( $column->get_value( $id ) );
	}
	return $value;
}
add_filter( 'ac/export/value', 'ac_export_acf_file_url', 10, 3 );

You can put this code in your functions.php or some other place where you manage your custom code.

4 years, 11 months ago

You must be logged in to reply to this topic.