1. Home
  2. Docs
  3. Divi ACF Object Loop
  4. Action & Filter Hook...
  5. Post Data

Post Data

Overview

The ctaol_get_post_data filter hook allows you to modify post data before processing. This filter can be combined with the ctaol_item_html_filter hook to add extra data to the items grid.

Hook Parameters

  1. $post_data: An array containing post data.
  2. $module_props: An array containing module-specific properties.
function ctaol_get_post_data_filter( $post_data, $module_props ) {
	// Use the admin label if you need to apply the filter only to a specific module
	if ( isset( $module_props['admin_label'] ) && $module_props['admin_label'] === 'request_extra_data' ) {
		$post_data['custom_data'] = get_post_meta( $post_data['id'], 'acf_text', true );
	}

	return $post_data;
}

add_filter( 'ctaol_get_post_data', 'ctaol_get_post_data_filter', 10, 2 );

0 Comments

Submit a Comment

How can we help?