Search results for ""

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

ACF is Blank, Prevent HTML rendering in WP-Admin Posts View?

I’ve got a CPT with a handful of Advanced Custom Fields attached to it. I’m also using Admin Columns Pro in the back end to help facilitate view/editing of all the data in list views. One of the fields is a Text Area field where we put Vimeo iFrame Embed Code. (On the front end of the CPT, I am displaying the resultant Vimeo video and all works great.) The problem is that in the posts/list view, the data is not showing. I believe it’s trying to render/process the resultant iframe embed code and returning nothing. But the data is there. Even if I use the inline edit feature of ACP, the data appears. I’m not sure if this is a question for Admin Columns Pro – but it seems more “WP Admin Specific” Thoughts?

Blank Field

Resultant Data

3 weeks ago

All the values that run through our column values are sanitized. We use wp_kses to sanitize the data and script and iframes are automatically removed by that function. If you want to render the actual iframes on your list page you can do that, but you’ll need to overwrite the value yourself with the following hook:

This hook runs after the sanitation, so if you call the value again of a column, it should render it without sanitation. I wrote the following snippet that will help you start with the hook. You might want to change the conditional to make it work for your use case.

add_filter( 'ac/column/value', function ( $value, $id, AC\Column $column ) {
	if ( $column instanceof ACA\ACF\Column && 'yourkey' === $column->get_meta_key() ) {
		$value = $column->get_value( $id );

	return $value;
}, 10, 3 );
2 weeks, 4 days ago

You must be logged in to reply to this topic.