0

I'd like to create some posts using wp_insert_post and then save the created posts' Titles and ID's into a text file for future reference. How could this be done?

1

1 Answer 1

1

You use add_action!

Like this:

function save_id_to_file($post_id){
 //use your file creation/save function here
 return $post_id;
}

add_action('wp_insert_post','save_id_to_file');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.