Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP before post inserting hook
<?php
add_action( 'wp_insert_post', 'wpse128767_add_meta' );
function wpse128767_add_meta( $post_id ) {
// do something here, add post meta for example
add_post_meta( $post_id, 'key', 'value' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment