How to make search and replace in content through php
From the documentation of WP All Import, the pmxi_saved_post
action takes one parameter, $id
, which is “the ID of the post/page/Custom Post Type that was just created.”
So, your post_saved()
callback should look like this:
add_action('pmxi_saved_post', 'wpse246838_post_saved', 10, 1);
function wpse246838_post_saved( $id ) {
$my_post = array(
"ID" => $id,
"post_content" => "1",
);
wp_update_post( $my_post );
}