title: How to auto fill the a custom_field with post_title value in wordpress post edit?
body: <p>I need in the act of publishing a post, a value insert in a custom_field,  the same post_title value!</p>
  
  <pre><code>function add_custom_field_automatically_two($post_ID) {
  global $post;
  $post_id = $post-&gt;ID;
  global $wpdb;
  //$my_customf = $post-&gt;post_title;
  //$my_customf = get_the_title( $post_id );
  $my_customf = "something string"; // worked, but I need post_title!       
  add_post_meta($post_ID, 'my_customf', $my_customf, true);
  }
  add_action('publish_page', 'add_custom_field_automatically_two');
  add_action('publish_post', 'add_custom_field_automatically_two');
  ?&gt;
  
  
  Thanks.
  </code></pre>