[Plugin: Posts 2 Posts] update_post_meta not working as i expected
-
Hello m8s.
I Need to save a value of a Connection on a custom field.
I did this:
<?php function cria_campos() { global $post; $relacionadocasa = new WP_Query( array( 'post_type' => 'casa-espectaculo', 'connected' => $post->ID ) ); while ($relacionadocasa->have_posts()) : $relacionadocasa->the_post(); $local_evento = $relacionadocasa->post_title; endwhile; update_post_meta($post->ID, 'local_evento', $local_evento); } add_action('publish_post', 'cria_campos'); ?>
Nothing is saved.
What i’m doing wrong?
The relationship is between post and ‘casa-espectaculo’ and i want to save to a custom field the value of the post title from casa-espectaculo post type.
Help me pls. Sorry about some erros writing english
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘[Plugin: Posts 2 Posts] update_post_meta not working as i expected’ is closed to new replies.