• Hi!

    I’m trying to modify the post meta before inserting a new post. I can’t finda anyway to do this. The closest I get is the wp_insert_post_data filter, but there I think I can only modify the $data array and not the $postarr array where the post meta are located:

    add_filter( ‘wp_insert_post_data’ , ‘modify_post_meta_before_insert’ , ’99’, 2 );
    function modify_post_meta_before_insert( $data , $postarr )
    {
    if($data[‘post_type’] == ‘special_post_type’) {
    // Here I would like to modify $postarr
    // $postarr[‘post_meta_type’] = …
    }
    return $data; // Here I can only return $data and not $postarr ?
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Modify post meta before inserting new post’ is closed to new replies.