Viewing 2 reply threads
  • Author
    Posts
    • #8459
      tomhodg
      Member

      The following function at the end my cpt file.
      I get an undefined index “_post_meta” .
      error is still happening when I revert to previously working version of wordpress.

      function tribute_new_title($data, $post_array) {
      $new_title = $post_array[‘_post_meta’][‘fn_text’] . ” ” . $post_array[‘_post_meta’][‘ln_text’];
      return $post_array[‘post_type’] == ‘tribute’ ? $new_title : $post_array[‘post_title’];
      }
      add_filter(‘piklist_empty_post_title’, ‘tribute_new_title’, 10, 2);

    • #8460
      Steve
      Keymaster

      @tomhodg– the $post_array is the post object as an array. Post objects do not include meta.

      You would have to use get_post_meta($post_array['ID'], 'fn_text', true)

    • #8462
      tomhodg
      Member

      Thank you Steve 🙂

Viewing 2 reply threads
  • The topic ‘wordpress 4.9 problem’ is closed to new replies.