• I have this function, and it prints, displays these values ??directly in the published posts:

    function gen_num()
    {
      global $post;
      $mixnames = get_post_meta( $post->ID, 'fieldnames', true );
    
      if ( '' == $mixnames ) {
        $input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
        $rand_keys = array_rand($input, 2);
        $mixnames = $input[$rand_keys[1]];
        update_post_meta( $post->ID, 'fieldnames', $mixnames );
      }
      // DISPLAYS THE OUTCOME
      print $mixnames;
    }

    I have this function, but she writes the values ??in the published already post, already recorded in post_meta directly in fildnames field, and when I go on the dashboard, in post-edit the post is white, but the post contains values, ie I can not edit them in edition mode.

    I heard say something like:

    'wp_insert_post_data', array $data, array $postarr

    and that output would be written in the fields:

    post_title, post_content, tags_input, in wp-admin/post.php

    but I do not know how to do this. I ask you to help.

    excuse me if I was not clear, let me know please This function, print its value, its output in the post, but printed directly on the published post, direct print on the website, the front-end, I want you to print that displays the values ??also in the fields of post in edit mode, so I altered them in case of need, as already saw in very plugin that make auto post, write us then in fields posts are printed on the website. How would this code? Thanks to all.

  • The topic ‘how to write the output of a function in wordpress standard fields? see them in’ is closed to new replies.