Skip Navigation

[Resuelto] Get field value of newly created inermediary post

This support ticket is created hace 5 años, 3 meses. There's a good chance that you are reading advice that it now obsolete.
Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Este tema contiene 0 respuestas, tiene 1 mensaje.

Última actualización por Max hace 5 años, 3 meses.

Asistido por: Shane.

Autor
Mensajes
#1316469

Max

Tell us what you are trying to do?
Get post meta of created inermediary post in wp-admin

Is there any documentation that you are following?
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_association_created

Is there a similar example that we can see?

add_action( 'toolset_association_created', 'handle_association_created', 10, 5 );
function handle_association_created( $association_slug, $parent_id, $child_id, $intermediary_id, $association_id ) {
	$my_taxonomy = 'fight';
	$fightnumber = types_render_field( 'fight-number', array( 'post_id'=>$intermediary_id) );
	$cat_id = get_term_by( 'slug', $fightnumber, $my_taxonomy );
	$cat_id = $cat_id->term_id;
	wp_set_object_terms($intermediary_id, $cat_id, $my_taxonomy);
}

This works

$fightnumber = types_render_field( 'fight-number', array( 'post_id'=>2032) );

This does not work

$fightnumber = types_render_field( 'fight-number', array( 'post_id'=>$intermediary_id) );

What am I doing wrong?